I was given a task to install a agent on computers and servers using command line as during my research I discovered this tool calls PSExec from the SysInternals Suite tools.
You may ask what is PSExec? According to Microsoft, it launches interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems. In other words, PSExec tool allows the execution of commands on a system remotely as if it is on the direct system console.
There are a number of features that I love about the PSExec tool which are as follows:
- It can run the command as another user remotely on the local system using user interaction
- It allows the execution of the command on multiple computers from a list in a text file
I was given the task to install the SAP Single Sign On add-in and it was difficult because it required that it is run under a network user locally in an interactive mode.
The PSExec tool gave me the power to overcome this difficulty.
Here is the syntax of the command and the parameters I used:
psexec.exe @[file-name.txt] -u [domain\username] -p -i -h [\\server\path\batch-files.bat]
explaining each switch:
@ execute the command on each computer in the file. Each computer must be in a new line
-u username
-p prompt for password
-i run command in interactive mode
-h run the command with account elevated privilege
This command will execute the script on each computer return the result as it is completed.
Please ensure it is executed on a computer that is running since it cannot be execute without the computer being on.