Shortcut on client to run bat file on a server

batch-filevbscript

Is it possible to place a shortcut on a client which will run a bat (or vbscript) file on a server? (as opposed to the script running on the client)

It seems pretty basic, but I'm at a loss how this would be done.

Best Answer

There is an excellent suite of tools called PsTools which includes PsExec. PsExec allows you to remotely execute programs on another machine (or in this case a server). You have to have the appropriate authority/credentials to do so of course.

The following psexec command would run the batch file my_batch_file.bat located in directory "C:\batch" (on the server) as user 'johndoe' with account password 'Asdf1234' on server with name 'ServerName':

psexec \\ServerName -u johndoe -p Asdf1234 c:\batch\my_batch_file.bat

Note that the batch file would have to exist on the server already in this example.

Read more about PsExec here: http://technet.microsoft.com/en-us/sysinternals/bb897553