How to use PSTools

How to use PSTools

PSTools are available from Microsoft. PsExec’s is a powerful tool  for sending interactive commands on command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems.

Setting up PSTools/PSexec

  1. Download PSTools/PSexec from Microsoft. (http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx Current link from Microsoft as of article publish.)
  2. Extract to a folder.
  3. Open cmd prompt and change to that folder with the psexec executable.
  4. Run psexec -accepteula -i -s \\computername -u username cmd -accepteula

Most Common commands would to be to restart/Shutdown a remote machine. Following is the Syntax:

Shutdown :    psshutdown -u username -p password \\remotecomputer

Reboot:   PsShutdown.exe -r -u username -p password \\RemoteComputerName

 

If you want to schedule the shutdown at a specific time you can use -t switch to specify the time in 24 hours format.  For example, to schedule remote computer shutdown at 3:30 pm today, the command would be:

PsShutdown.exe -t 15:30 -u username -p password \\Remotecomputer

 

Services restart: But before you can connect to a remote system using PsService, you need to make sure ports 445 and 139 are open on the remote computer. This means, if the computer is running a firewall, or a firewall exists between your computer and the remote computer, those ports need to be open.

Note: find our services for each application once you want to reboot it.

psservice.exe \\rcomputer -u mike -p 123456 start spooler

Where:\\rcomputer – is the name of the remote computer.

-u mike -p 123456 – is the username and password of the account that has administration rights on the remote computer.

start spooler – is the command to start the service named spooler.

 

 List of Tools which you can use from downloadable Zip file which contains all these tools.  

  • PsExec – execute processes remotely
  • PsFile – shows files opened remotely
  • PsGetSid – display the SID of a computer or a user
  • PsInfo – list information about a system
  • PsPing – measure network performance
  • PsKill – kill processes by name or process ID
  • PsList – list detailed information about processes
  • PsLoggedOn – see who’s logged on locally and via resource sharing (full source is included)
  • PsLogList – dump event log records
  • PsPasswd – changes account passwords
  • PsService – view and control services
  • PsShutdown – shuts down and optionally reboots a computer
  • PsSuspend – suspends processes
  • PsUptime – shows you how long a system has been running since its last reboot (PsUptime’s functionality has been incorporated into PsInfo)

 

Author of PSTools have other interesting tools which can be explored at : https://live.sysinternals.com/



Leave a Reply