PsExec
- Thiru T
- Dec 23, 2024
- 1 min read
PsExec is a part of the Sysinternals suite of tools, which is a collection of utilities for managing and troubleshooting Windows systems.
It is great for remotely executing commands on target machines.
Note: Some AVs detect PsExec as a 'remote admin' virus.
Install: (PowerShell)
Invoke-WebRequest -Uri 'https://download.sysinternals.com/files/PSTools.zip' -OutFile 'pstools.zip'
Expand-Archive -Path 'pstools.zip' -DestinationPath "$env:TEMP\pstools"
Move-Item -Path "$env:TEMP\pstools\psexec.exe" .
Remove-Item -Path "$env:TEMP\pstools" -Recurse
Usage:
# Prevent the license agreement from being displayed
psexec.exe /accepteula
# Run the 'hostname' command on remote machine
psexec.exe \\REMOTECOMPUTER hostname
# Run the 'hostname' command on EVERYTHING (on the domain)
psexec.exe \\* hostname
# Run a local executable on a remote machine
psexec.exe \\REMOTECOMPUTER -c C:\Tools\program.exe
# Run the 'hostname' command with different credentials
psexec.exe \\REMOTECOMPUTER hostname -u localadmin -p secret-p@$$word
# Spawn shell on remote machine
psexec.exe -s \\REMOTECOMPUTER cmd
Great blog post on PsExec usage.

Comments