Windows – PsExec is not copying file over to execute

psexecvbscriptwindows

I want to run a script I called "systemInfo.vbs" that outputs to a logfile the system name and service pack.

In command prompt I am doing "PsExec.exe \REMOTECOMPUTER -c systemInfo.vbs".

I am running this from a directory on my local system that has ONLY PsExec.exe and systemInfo.vbs

I get the error

PsExec could not start systemInfo.vbs on REMOTESERVER: "The system
cannot find the file specified.

Any idea why this may be? I thought I could do this to run a remote script as if it is on the remote server?

Best Answer

You need to give the path to your script either on the remote pc or through a UNC path on a share on your pc or a netsworkdrive. So if the script has a copy on the remote c:\

PsExec.exe \\REMOTECOMPUTER -c c:\systemInfo.vbs

or if it is on the share \\mypc\shared

PsExec.exe \\REMOTECOMPUTER -c \\mypc\shared\systemInfo.vbs

Also you need to make sure you have administrator rights on the pc where you start the script and depending on what your script does possibly on the remote pc as well.

Related Topic