views:

712

answers:

1

I need the correct way to accomplish this via a vbscript.

This works fine from command prompt:

psexec \\99.99.99.99 -u username -p password cmd.exe /c ver > output.txt

From the vbscript:

sTempFile = objFSO.GetTempName
sCmd = "psexec \\" & sIP & " -u " & sDomain & "\" & sUser & " -p " & sPassword & "    cmd /c ver  > " &  sTempFile 

WSHShell.Run sCmd, 1, True

I always get a runtime error: File not found

Thanks, Sam

+1  A: 

Dont know why but adding cmd /c also before psexec did the trick.