Caveman's Blog

My commitment to learning.

PSExec: Execute batch files remotely

with 2 comments

PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec’s most powerful uses include launching interactive command-prompts on remote systems. [1]

Ad-hoc execution of batch files from on server remotely using psexec is an easy and a time saving activity. Here is an example of how to execute a batch file using psexec:

psexec \\REMOTESERVERNAME -u [USERNAME] -p [PASSWORD] /accepteula -d -i cmd /c D:\FILE.bat

cmd /c – this gives a context to the psexec to

/accepteula – this switch will simulate the accepting eula agreement.

D:\ – drive on the remote server

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

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

The output of the execution would be that cmd exited on with error code 0.

Update: 09-13-2012

All of a sudden the above command started to fail. At this point my guess is that some network settings/permissions must have got updated preventing the command to execute successfully. Following is the error

Error: The parameter is incorrect.

Fix: psexec \\REMOTESERVERNAME -u [USERNAME] -p [PASSWORD] /accepteula -h cmd /c D:\FILE.bat


1. PsExec v1.98


Written by cavemansblog

June 22, 2012 at 10:32 pm

2 Responses

Subscribe to comments with RSS.

  1. Please I am controlling a school network which i have build a batch script that calls PSexec to execute a command on another computer in the network.

    Below is the command:

    psexec.exe -d \\miniserver “c:\program files\internet explorer\iexplore.exe”

    but anytime i run it says:

    Couldn’t access miniserver:
    Access is denied.

    And also all the computers in the network is running on the in-built Administrator Account only and without any password.

    So please is there anything or tweak i can make to make this work?. Because all computers on the network have black password but still psexec.exe reports Access is denied.
    Back to Top


    May 21, 2013 at 8:38 pm

    • You could try the following
      1. Create a new user account with admin priviliges on the miniserver.
      2. pass this user login/password as arguments when executing psexec

      psexec.exe \\miniserver -d -u [USERNAME] -p [PASSWORD] “c:\program files\internet explorer\iexplore.exe”


      May 24, 2013 at 7:52 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: