Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

need to push(deploy) few batch files to the machines on a network. All nodes are running Windows. The batch files contain some commands to initialize an env on each node.

what ways can this be accomplished? any tools readily available? thanks in adv.

share|improve this question
    
So you want to just copy the files to the computers? What's wrong with a quick batch/PS file to copy them? –  Chris S Mar 16 '11 at 12:48
    
just to copy the files to multiple nodes on network and launch the batch files automatically –  John-ZFS Mar 16 '11 at 14:45
add comment

1 Answer 1

up vote 2 down vote accepted
  1. Create list of computers in a file (not exactly necessary, but usually the easiest), named computer.list (or whatever):

    wsn101
    wsn102
    wsn103
    
  2. Run batch file:

    for %%i in (computer.list) do copy file_to_push.ext \\%%i\c$
    for %%i in (computer.list) do psexec \\%%i C:\file_to_push.ext
    

    (Fixed this part, cp isn't right, should be copy)
    Link to download psexec if you don't have it already.

    Same thing in PS:

    foreach ($wsn in Get-Content Computer.List)
    {
        cp file_to_push.ext \\$wsn\c$
        psexec \\$wsn C:\file_to_push.ext
    }
    
share|improve this answer
    
should these hostnames resolve to IPs? –  John-ZFS Mar 16 '11 at 17:23
    
@John, yes the names must resolve via NetBIOS or DNS; unless you're using NetBEUI. –  Chris S Mar 16 '11 at 19:27
    
the above code is not working "syntax error in for loop"...I am not good in MS DOS batch...could you help pls? any equivalent in powershell? –  John-ZFS Mar 17 '11 at 14:19
    
@John - I updated the batch script with the correct %%i syntax. The %i would only work when typed from a command line. –  Doug Luxem Mar 17 '11 at 17:33
    
@Doug, thank you, been too long since I used batch files apparently. –  Chris S Mar 17 '11 at 17:42
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.