Friday, October 14, 2011

Run psexec.exe for list of computers stored in text file | batch file to ping a list of computers in a text file | Give input to command prompt from a text file


  Psiexec.exe is a nice, handy command line utility given by Microsoft through which we can run batch commands remotely to remote computer.

  Consider a situation when you need to run a specific or a set commands to multiple no of computers remotely from your computer across your LAN.

  This script described in this post will fetch computer names from a text file and run commands remotely with psiexec.exe command line utility...

 Let's say that you need to renew ip address in many computers across your LAN,

First thing you need to do is to download ps tools from http://technet.microsoft.com , extract the zip file and past all the files to c:\windows\syste32\ folder.

Then copy the below command lines and paste to a text file. rename it to ipenew.cmd

for /f %%a in (c:\users\delphin\desktop\list.txt) do (
psexec \\%%a ipconfig /renew
)

replace "delphin" with your login profile, make a text file with list of computer names or ip address (one computer name in a line)



That's it. Double click the iprenew.cmd file to run it from your computer. That will take the computers names from the text file and will run the ipconfig /renew command in each of those computers.


Hope this helps..
                                                                                                                                   Techytips

Reactions:

3 comments:

Ethan said...

Thank you, that did it

S A Delphin said...

Glad it worked for you Ethan

anon ymous said...

Help. It didn't work. Command only runs on 1 PC

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons