James Ray Anderson

James Ray Anderson
James Ray Anderson
0 comments

Quick Tutorial on PSEXEC

9:51 AM
There are numerous articles on the PSEXEC tool and the tools of the suite. But my experience in deployment automation helped me weed out things so that I could focus on the basics.

Originally created by Sysinternals, but now a part of Microsoft Technet, you will likely find it invaluable when it comes to automation. IT administrators have been using this for years.

This post is going to provide some information on how to use PSEXEC. There is a catch - you have to have administrative or the appropriate rights on the target machine to perform execution. In essence, if you cannot remote desktop or login the machine, you won't be able to use it.

Before you get started you will need to get the tools from the Microsoft TechNet website. Download the tools, install them to C:\Sysinternals for the purposes of this article.

Example:      psexec.exe \\theserver ipconfig /all
Explanation: Executes the IPCONFIG command and returns the results to the local window.

Also keep in mind that when executing something it has to exist on the target server.

Example:      psexec.exe \\theserver c:\installer.exe
Explanation: Executes the installer.exe file on \\theserver.

You can use the PSEXEC command option -C to copy the item to the server and then execute it.

Example:       psexec.exe \\theserver -c someinstaller.exe
Explanation: Copies the installer to the remote machine and then executes it.

When using the PSEXEC tool the account and privileges it runs under is determined by the executing account. You can override this by specifying a domain or local account and password. Just be careful. The account and password are sent in clear text and are easily visible.

Example:      psexec.exe \\theserver -u domain\somelogin -p Pa88werd c:\installer.exe
Explanation: Executes the installer.exe on \\theserver under the specified user name and passsword.

If you want to run the same item on multiple servers you have a couple of options. First, you can specify a semi-colon delimited list of servers. Or, you can use an external file with a semi-colon delimited list of servers.

Example: psexec.exe \\theserver;\\thatserver -c someinstaller.exe
Example: psexec.exe listofservers.txt c:\batchfile.bat

0 comments:

 
Toggle Footer
Top