I am using “PSexec” command when executing a remote command with windows powershell. Here is an example of how to use this command.
First of all you have to download the package from Microsoft technet website. The URL is:
After you’ve downloaded the .zip file, extract the commands or only PSexec command to your windows system folder. In my case the path is C:\Windows\System32.
After that, start windows powershell and type PSexec. The legal agreement appears you’ll have to press “Accept” in order to use the command. You can type the following command : “Get-help PSexec” and the following screen will appear:
This command will explain the basics of how to use PSexec command. I am trying to execute ipconfig /all to find out the gateway of a server but I get the following error “Logon failure: unknown user name or bad password”. If this problem occurs you’ll have to enter the credentials that the session will use to logon to the remote server. To do this include the -u parameter in the command. After typing the -u you’ll have to type the domain name followed by “\” and the username. You can either add the -p parameter followed by the username password in clear text or let the command without it. The password promt will automatically show. This is an example of this command:
psexec.exe \\server -u domain\dan_popescu ipconfig /all
PSexec is very usefull in many situations. For example to debug a problem on a remote computer you can start the cmd.exe remotely and then execute any command.
psexec.exe \\server -u domain\dan_popescu cmd.exe.
Upon finishing type “exit” to leave the remote machine and return in your computer. Windows powershell will display something like “the command used” on “remote machine” “with error code 0”.