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:
Thank you, that did it
Glad it worked for you Ethan
Help. It didn't work. Command only runs on 1 PC
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
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