-
Download PsExec from the Sysinternals Suite.
-
Extract
PsExec.exeto a convenient location (e.g.,C:\Tools\). -
Open a Command Prompt as Administrator and navigate to the folder where
PsExec.exeis located:cd C:\Tools
Run a command on a remote computer:
psexec \\RemoteComputerName cmdThis opens a command prompt on the remote computer.
Execute a command remotely without opening an interactive session:
psexec \\RemoteComputerName -u UserName -p Password ipconfigThis runs ipconfig on the remote machine.
If the remote machine is in a domain, specify the domain with your credentials:
psexec \\RemoteComputerName -u Domain\UserName -p Password cmdFor security reasons, avoid using plain-text passwords. Instead, use a secure method such as interactive authentication.
psexec \\RemoteComputerName systeminfopsexec \\RemoteComputerName shutdown -r -t 0psexec \\RemoteComputerName -u UserName -p Password -i -d C:\Scripts\example.batpsexec \\RemoteComputerName -u UserName -p Password -c "C:\Path\To\Setup.exe" /silentpsexec \\RemoteComputerName reg add "HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /fpsexec \\RemoteComputerName winrm quickconfig -qTo run a command as NT AUTHORITY\SYSTEM on the local machine:
psexec -s cmdCopy and execute a program on a remote machine:
psexec \\RemoteComputerName -c C:\Path\To\Program.exeRun a command on multiple remote machines:
psexec @computers.txt ipconfigcomputers.txt should contain a list of remote machine names (one per line).
If PsExec fails to connect, ensure Admin Shares are enabled and the remote machine allows SMB traffic:
net use \\RemoteComputerName\IPC$ /u:Domain\UsernameEnsure the Windows Firewall allows File and Printer Sharing (SMB-In).
Kill a process on a remote machine:
psexec \\RemoteComputerName taskkill /IM notepad.exe /FTo exit a PsExec session, simply type:
exitFor more options, run:
psexec -hThis summary provides essential commands to use PsExec for remote administration and troubleshooting.