Author: ryguy7272
Subject: How to execute a batch file on a remote computer?
Posted: 06 October 2014 at 7:15pm
Subject: How to execute a batch file on a remote computer?
Posted: 06 October 2014 at 7:15pm
I have a VBA procedure that loops through many elements in an array. This used to work fine on a XP machine, but it was just upgraded to Windows 7, and now it doesn't work.
Shell ("psexec \\" & rCell & " C:\Windows\post-script.bat")
rCell is a name in a name in an Excel Cell.
I've tried a bunch of things. This looked promising, but didn't work.
Set objShell = CreateObject("wscript.shell")
objShell.Run ("runas /user:domain\administrator psexec \\" & rCell & " C:\Windows\post-script.bat"), 1, True
I tried this as well:
Shell ("psexec \\" & rCell & "-u " & rCell & " -p [password] /accepteula -h cmd /c" & " C:\Windows\post-script.bat")
It's still not working.
Has anyone tried this and gotten it to work? If so, please do share!!