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

5 comments:

Ethan said...

Thank you, that did it

S A Delphin said...

Glad it worked for you Ethan

Unknown said...

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

pslvseo a8 said...

A Plain Text Editor
Plain Text files
That's right, if you're writer on a budget, you don't need to spend any money buying expensive writing software or apps. Instead, you can use the text editor that comes free with your operating system.
Just open up Notepad on Windows or TextEdit on a Mac. I like plain text editors for writing something short quickly and easily, without thinking much about it. I wrote a blog post about the benefits of using plain text editors as writing software.
Use for: writing whatever, wherever

VertigoRay said...

PSExec handles reading in computers from a text file without the need for writing a loop:

psexec @c:\users\delphin\desktop\list.txt ipconfig /renew

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

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