-1

I've been using PSExec.exe to run a vbscript on a few hundred remote virtual machines. This is generally working. However, on a small group of VM's, I get this error:

MyScriptName.vbs(24, 5) WScript.CreateObject: Could not create object named "ADODB.Connection"

Here is the offending line of code in the vbscript file:

Set oConn = WScript.CreateObject("ADODB.Connection")

I have tried this (for 64-bit cscript.exe):

PsExec.exe \\RemoteVMName  -c -h -u MyDomain\MyWinLogin -p MyPwd cscript.exe "\\UncPath\To\My\Script.vbs"

And I tried this (for 32-bit cscript.exe):

PsExec.exe \\RemoteVMName  -c -h -u MyDomain\MyWinLogin -p MyPwd C:\Windows\SysWOW64\cscript.exe "\\UncPath\To\My\Script.vbs"

Curiously, if I log into the remote VM, I can manually run the vbscript file. It succeeds with no script errors. What could be causing that vbscript error?

Dave Mason
  • 4,746
  • 2
  • 23
  • 24
  • Why do you think your first line will run 64 bit cscript. My Psexec is 32 bit so any reference to `system32` will get redirected into `SysWoW64`. Use `C:\Windows\SysNative` to refer to System32 in a 32 bit program. –  May 11 '15 at 22:26

1 Answers1

0

You should include cmd.exe /c for executing vbs files with cscript over psexec.

You don't need to copy the script file as long as the account can access that UNC path.

PsExec.exe \\RemoteVMName -e -h -u MyDomain\MyWinLogin -p MyPwd cmd.exe /c cscript.exe "\\UncPath\To\My\Script.vbs"
PatricK
  • 6,375
  • 1
  • 21
  • 25