ss64.com Open in urlscan Pro
216.92.186.205  Public Scan

URL: https://ss64.com/nt/psexec.html
Submission: On June 21 via api from DE — Scanned from DE

Form analysis 1 forms found in the DOM

GET https://www.google.com/search

<form action="https://www.google.com/search" method="get">
  <input type="text" name="q" id="qu" size="27" maxlength="255" aria-label="Search text">
  <input class="submit mousetrap" value="Search" id="btn" type="submit">
  <input type="hidden" name="sitesearch" value="ss64.com/nt/">
</form>

Text Content

WE VALUE YOUR PRIVACY

We and our partners store and/or access information on a device, such as cookies
and process personal data, such as unique identifiers and standard information
sent by a device for personalised ads and content, ad and content measurement,
and audience insights, as well as to develop and improve products. With your
permission we and our partners may use precise geolocation data and
identification through device scanning. You may click to consent to our and our
partners’ processing as described above. Alternatively you may click to refuse
to consent or access more detailed information and change your preferences
before consenting. Please note that some processing of your personal data may
not require your consent, but you have a right to object to such processing.
Your preferences will apply to this website only. You can change your
preferences at any time by returning to this site or visit our privacy policy.
MORE OPTIONSDISAGREEAGREE
 * SS64
 * CMD
 * How-to
 * 


PSEXEC (SYSINTERNALS)

Execute a command-line process on a remote machine.

Syntax
      psexec \\computer[,computer[,..] [options] command [arguments]

      psexec @run_file [options] command [arguments]

Options:

   computer   The computer on which psexec will run command. Default = local system 
              To run against all computers in the current domain enter "\\*"
               
   @run_file  Run command on every computer listed in the text file specified.

   command    Name of the program to execute on the remote machine.

   arguments  Arguments to pass (file paths must be absolute paths on the target system)

   -a n,n,... Set processor affinity to n. Processors are numbered as 1,2,3,4 etc
              so to run the application on CPU 2 and CPU 4, enter: "-a 2,4"

   -c         Copy the program (command)to the remote system for execution.
   -c -f      Copy even if the file already exists on the remote system.
   -c -v      Copy only if the file is a higher version or is newer than the remote copy.

   If you omit the -c option then the application must be in the system path on the remote system.

   -d         Don’t wait for the application to terminate.
              Only use for non-interactive applications.

   -e         Do NOT load the specified account’s profile.
              (In early versions of PSEXEC: Load the user account's profile, don’t use with -s)

   -f         Copy the specified program even if the file already exists on the remote system.

   -h         Run with the account's elevated token, if available. (Vista or higher)

   -i         Interactive - Run the program so that it interacts with the desktop on the remote system.
              If no session is specified, the process runs in the console session.

   -l         Limited - Run process as limited user.  Run with Low Integrity.
              Strips the Administrators group and allows only privileges assigned to the Users group.

   -n s       Specify a timeout (s seconds) for connecting to the remote computer.

   -p psswd   Specify a password for user (optional). Passed as clear text.
              If omitted, you will be prompted to enter a hidden password.

   -r         The name of the remote service to create or interact with.

   -s         Run remote process in the SYSTEM account (use with caution).

   -u user    Specify a user name for login to remote computer(optional).

   -v         Copy the specified file only if it has a higher version number or is newer
              than the one on the remote system.

   -w directory Set the working directory of the process (relative to the remote computer).

   -x         Display the UI on the Winlogon desktop (local system only).

   -low, -belownormal, -abovenormal, -high or -realtime
              These options will run the process at a different priority.
              also -background (Vista and above) will run at low memory and I/O priority.

   -accepteula Suppress the display of the license dialog.

For PsExec to work, File and Printer sharing must be enabled on the remote
computer. This can be done with netsh advfirewall or Group Policy (Local
Computer Policy ➞ User Configuration ➞ Administrative Templates ➞ Windows
Components ➞ Network Sharing)
You may also have to enable it under Control Panel ➞ Network ➞ Network Adapter ➞
properties.

If you omit username the remote process will run in the same account from which
you execute PsExec, but because the remote process is impersonating it will not
have access to network resources on the remote system.

When you specify a username the remote process will execute in that account, and
will have access to that account's network resources. If you do specify an
alternative username/password, then PsExec will send the logon password in clear
text. This can be a security risk if unauthorized network sniffers could
intercept traffic between the local and remote system.

PsExec can be used to start GUI applications, but in that case the GUI will
appear on the remote machine.

Input is passed to the remote system when you press the enter key - typing
Ctrl-C will terminate the remote process.

PsExec does not require you to be an administrator of the local filesystem, with
the correct password psexec will allow UserA to run commands as UserB - a Runas
replacement.

If you kill a PsExec process, you might also need to manually remove the
background service:
sc.exe \\workstation64 delete psexesvc

PsExec can also be used to start a process (on a remote or local machine) as
SYSTEM, this is a very privileged account similar to root on a UNIX machine ~
use with extreme caution.

Error codes returned by PsExec are specific to the applications you execute, not
PsExec.


ACCEPT EULA

> When launched for the first time, PsExec will prompt you to accept the EULA.
> There is a command line option for this, but Psexec will swallow the first
> "-accepteula" on the command line, no matter where it occurs, so when using
> psexec to run any other ps* utilities, you will have to pass "-accepteula"
> twice:
> 
> psexec -accepteula -s c:\utils\pslist.exe -accepteula
> 
> Surround any long filenames "with quotation marks"
> 
> Alternatively just write directly to the license registry key:
> 
> 
> Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Sysinternals' -Name 'EulaAccepted' -Value 1


INTERNAL COMMANDS

> Internal commands (such as COPY, CD, DIR etc) are only available within the
> CMD shell. To run these commands from PsExec you must call CMD /C and then
> pass the commands as parameters - see the examples below.


EXAMPLES

Launch an interactive command prompt on \\workstation64, the CMD prompt window
will appear locally:
(This is equivalent to PowerShell: New-PSSession ServerName ; Start-PSSession
ServerName)

C:\> PSEXEC \\workstation64 CMD

Launch an Elevated interactive command prompt on \\workstation64, this must be
run from a local command prompt which is already elevated:

C:\> PSEXEC \\workstation64 -h CMD

Launch an Elevated interactive PowerShell prompt on \\workstation64, this must
be run from a local command prompt which is already elevated:

C:\> PSEXEC \\workstation64 -h powershell

Execute a program that is already installed on the remote system:

C:\> PSEXEC \\workstation64 "c:\Program Files\test.exe"

Connect to workstation64 and run IPCONFIG to display the remote PC's IP address:

C:\> PSEXEC \\workstation64 ipconfig

Connect to workstation64 and list a directory:

C:\> PSEXEC \\workstation64 -s cmd /c dir c:\work

Connect to workstation64 and copy a file from another server:

C:\> PSEXEC \\workstation64 -s cmd /c copy \\server21\share45\file.ext
c:\localpath

Execute IpConfig on the remote system, and display the output locally:

C:\> PSEXEC \\workstation64 ipconfig /all

Copy the program test.exe to the remote system and execute it interactively,
running under the account DannyGlover:

C:\> PSEXEC \\workstation64 -c test.exe -u DannyGlover -p Pa55w0rd

Run Internet Explorer on the local machine but with limited-user privileges:

C:\> PSEXEC -l -d "c:\program files\internet explorer\iexplore.exe"

Run Regedit on the local machine with SYSTEM privileges:

C:\> PSEXEC -s -i regedit.exe

From PowerShell, run a VBscript on a remote workstation, pass some parameters
and log the result:

$script='C:\Program Files\demo.vbs'
$args = "some more stuff"
& PSEXEC -s \\workstation64 "c:\windows\system32\cscript.exe" $script $args /log
'C:\logs\demo.txt'

“Don’t ask what the world needs. Ask what makes you come alive, and go do it.
Because what the world needs is people who have come alive” - Howard Thurman


RELATED COMMANDS

Q942817 - Remote UAC LocalAccountTokenFilterPolicy setting (allow remote
administration)
RUNAS - Execute a program under a different user account.
xCMD - 3rd party utility.
Equivalent PowerShell command: Invoke-Command
Equivalent bash command (Linux): xon - start an X program on a remote machine.

Powered by pixfutureⓘ


--------------------------------------------------------------------------------

 
Copyright © 1999-2023 SS64.com
Some rights reserved