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.

We have fairly small windows (XP/7) based network of about 15 machines. I have developed a few software applications that we use internally which are updated regularly. To update the software, the user must close and reopen the application. They are then prompted to do the update.

So here's my question...I have system admin privileges, is there any way I can do this for each machine on the network from my machine? Essentially, I want a script to kill 'SomeProcess.exe' and then start 'SomeProcess.exe' for every machine on our network that I can execute from my desktop.

share|improve this question
    
Thanks for your help on this guys, learn something new everyday! Also, the PsTools are great for messing with your co-workers... –  dfarney Jan 28 '11 at 14:46
add comment

2 Answers

up vote 1 down vote accepted

If you want to do one machine at a time you can do this in good old fashion command prompt with "taskkill /S MACHINENAMEHERE /U yourusername /F /IM process.exe"

If you want to be really efficient, let's use powershell v2.0

If you are using AD I would lookup installing the QUEST AD CMDlets and then take a peek at: Quest Wiki: on GET-QADCOMPUTER

Otherwise, if you are not using AD I would put all computer names into a CSV and use something like the following bit of powershell and using PSKILL and PSEXEC as Sam mentioned above:

$username = "YourUserName"

$password = "YourPassword"

$process = "YourProcess.exe"

$pathtoCSV = "pathto.csvfile"

Import-CSV $pathtoCSV | ForEach-Object{

  PSKILL $._columnfromCSVComputername -u $username -p $password $process

  Start-Sleep -s 10 #wait for process to die

  PSEXEC $._columnfromCSVComputername 'C:\PATH\'$process '-i'

}

Of course you will have to make some changes to the above, and likely adjust the syntax a bit... but it should at least get you started

share|improve this answer
    
That only gets him the first part - killing the process. –  mfinni Jan 27 '11 at 21:35
1  
sorry, fixed. IE9 is really screwing up my edits. –  LeeBerg Jan 27 '11 at 21:41
add comment

Assuming your ok with using sysinternal tools, you could use PSKill to kill the proces remotely (assuming you know the process name)

pskill \\computer -u username -p password processname

You could then use PSExec to start the application again.

psexec \\computer c:\ application.exe -i

share|improve this answer
    
One hardly needs PowerShell for that. You can do it in BAT or any other script you care to think of. –  mfinni Jan 27 '11 at 21:34
    
@mfinni indeed you are correct, and I shouldn't try and do 2 things at once. I was considering how you would do this with PS Remoting while writing –  Sam Jan 27 '11 at 21:39
add comment

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.