Build PsExec commands to run programs on remote Windows machines.
PsExec is a lightweight remote-execution tool from Microsoft Sysinternals. It lets you run a program or command on another Windows machine over the network and see the output on your own console, without installing any agent or remote-desktop software on the target. Admins use it to open a remote shell, run diagnostics, or push a quick fix across machines. This builder assembles the command with safe defaults — including leaving the password off the command line.
PsExec is powerful and is also widely abused by malware for lateral movement, so EDR and antivirus tools may flag or block it. Use it only on machines you administer, and omit the -p password switch so you are prompted instead of storing the password in your shell history.
psexec \\COMPUTER -accepteula [options] command| Option | Meaning |
|---|---|
\\COMPUTER | Target hostname or IP (double backslash prefix) |
-s | Run as the SYSTEM account (highest local privilege) |
-i | Interactive — show the program UI on the remote session |
-c | Copy the named program to the remote machine before running |
-d | Do not wait — start the process and return immediately |
-u USER | Run as a specific account (you are prompted for the password) |
-accepteula | Skip the first-run license dialog (needed for scripting) |
psexec \\PC01 -accepteula cmd
psexec \\PC01 -accepteula -s ipconfig /all
psexec \\PC01 -accepteula -u DOMAIN\admin -i powershellThe first opens an interactive Command Prompt on the remote PC. The second runs a command as SYSTEM and returns the output. The third launches PowerShell interactively under a named admin account, prompting for the password rather than embedding it.
-p makes PsExec prompt for it, keeping it out of history and logs.-s only when you genuinely need SYSTEM — it bypasses user-level restrictions.Invoke-Command over WinRM is often a cleaner, better-logged alternative.PsExec is a Sysinternals tool that runs programs and commands on remote Windows machines without installing anything on them. Admins use it to open a remote command shell, run diagnostics, or apply a quick fix across computers, with the output shown on their own console.
Leave the -p switch off the command line. When you specify a user with -u but no -p, PsExec securely prompts you for the password at runtime instead of storing it in your shell history or logs, which is the recommended practice.
PsExec is a legitimate admin tool, but attackers and malware frequently abuse it for lateral movement across a network. Because of that reputation, EDR and antivirus products often flag or block it. Use it only on machines you manage, and expect to allow-list it in your security tooling.
The -s flag runs the remote command under the local SYSTEM account, the highest-privilege built-in account on the machine. It bypasses user-level restrictions, so use it only when a task genuinely requires SYSTEM rights, such as certain service or registry operations.