9

Is it possible to use psexec to run a local bat file on a remote computer (windows 7)? or would I have to first copy it over to the remote location and then run it?

7

I would suggest using psexec which is part of the SysInternals Suite.

psexec \\remotemachine -u remoteuser -i -d cmd -c localdisk:\folder\batchfile.bat

-c will copy from local path

| improve this answer | |
0

You can use WMIC or SCHTASKS:

1) SCHTASKS:

SCHTASKS /s remote_machine /U username /P password /create /tn "On demand demo" /tr "C:\some.bat" /sc ONCE /sd 01/01/1910 /st 00:00
SCHTASKS /s remote_machine /U username /P password /run /TN "On demand demo" 

2) WMIC (wmic will return the pid of the started process)

WMIC /NODE remote_machine /user user /password password process call create "c:\some.bat","c:\exec_dir"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.