Author: angeloahmed
Subject: Unable to run psexec with file output
Posted: 09 May 2014 at 3:17pm
Just doing a simple test script
I am working in a mixed environment with non-domain machines across VPN so trying to use normal WMI domain/user/pass doesn't work.
If I just run the line:
I tried putting it like this too but no change:
Subject: Unable to run psexec with file output
Posted: 09 May 2014 at 3:17pm
Just doing a simple test script
Set oShell = CreateObject ("WScript.Shell")
strComputer = "10.220.0.11"
Set oExec = oShell.Exec("psexec \\10.220.0.11 -u administrator -p p4ssw0rd! cscript.exe /nologo C:\sn.vbs -x 2>nul>c:\test.txt")
I am working in a mixed environment with non-domain machines across VPN so trying to use normal WMI domain/user/pass doesn't work.
The work around has been to copy the VBS over and then get the output locally and output into a text file.
it works, but in this script it does not output the text file locally for me (no it doesn't go on the remote machine).
If I just run the line:
psexec \\10.220.0.11 -u administrator -p p4ssw0rd! cscript.exe /nologo C:\sn.vbs -x 2>nul>c:\test.txt"
It executes the script remotely, outputs locally the results and outputs the file without the psexec output to c:\test.txt just fine.
Any idea why this is happening?
I tried putting it like this too but no change:
psexec \\" & strComputer & " -u administrator -p p4ssw0rd! cscript.exe /nologo " & chr(34) & "C:\sn.vbs" & chr(34) & " -x 2>nul>c:\test.txt