Execute a command-line process on a remote machine.
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.
How To Accept Eula
It’s also important to note that we set the ACCEPTEULA environment variable to Y which is needed when running apt-get install msodbcsql. It signifies that you’ve accepted the End-user license agreement when installing the package. The next RUN instruction installs PHP extensions using the official PHP image’s docker-php-ext-install script. In this article. Controllers are a central part of any ASP.NET Core API service and ASP.NET MVC Web application. As such, you should have confidence they behave as intended for your application.
Input is passed to the remote system when you press the enter key - typing Ctrl-C will terminate the remote process.
Accept_eula=y Dockerfile
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.
Accept eula
When launched for the first time, PsExec will create the license registry key:
HKCUSoftwareSysinternalsPsExecEulaAccepted=0x01
Psexec will swallow the first '-accepteula' on the commandline, 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:utilspslist.exe -accepteula
Surround any long filenames 'with quotation marks'
Error codes returned by PsExec are specific to the applications you execute, not PsExec.
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-PSSessionServerName ; Start-PSSession ServerName)
PSEXEC workstation64 CMD
Execute a program that is already installed on the remote system:
PSEXEC workstation64 'c:Program Filestest.exe'
Connect to workstation64 and run IPCONFIG to display the remote PC's IP address:
PSEXEC workstation64 ipconfig
Accept_eula
Connect to workstation64 and list a directory:
PSEXEC workstation64 -s cmd /c dir c:work
Connect to workstation64 and copy a file from another server:
PSEXEC workstation64 -s cmd /c copy server21share45file.ext c:localpath
Execute IpConfig on the remote system, and display the output locally:
PSEXEC workstation64 ipconfig /all
Copy the program test.exe to the remote system and execute it interactively, running under the account DannyGlover:
PSEXEC workstation64 -c test.exe -u DannyGlover -p Pa55w0rd
Click Accept Eula
Run Internet Explorer on the local machine but with limited-user privileges:
PSEXEC -l -d 'c:program filesinternet exploreriexplore.exe'
Run Regedit on the local machine with SYSTEM privileges:
PSEXEC -s -i regedit.exe
From PowerShell, run a VBscript on a remote workstation, pass some parameters and log the result:
$script='C:Program Filesdemo.vbs'
$args = 'some more stuff'
& PSEXEC -s workstation64 'c:windowssystem32cscript.exe' $script $args /log 'C:logsdemo.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
Accept_eula 1
Related commands:
SysInternals Forum
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.
Msi Accept Eula
Some rights reserved