After few unsuccessful tries; no way to get the StdOut I've start finding other reason than my poor programmer knowledges. So after few search on Google, I've discover that there is a known bug on PsExec versions prior to 1.98.
As ever and as recommended by software and hardware providers always update to the latest available version of code...
So here's the link to PSTools lastest version on Microsoft website. These tools are certainly the most useful toolbox for a Windows administrator. That might explain why Microsoft has acquire Sysinternal
If it helps, here's the script which should works with PsExec v1.98. Provided as is...
Option Explicit
On Error Resume Next
Dim WshShell, oExec, Cmmd, CptName, UsrName, UsrPWd, PsxCmmd, PsxReturn, PSPath
Set WshShell = CreateObject("WScript.Shell")
CptName = "ComputerName"
UsrName = "UserName"
UsrPWd = "Paswword"
PsxCmmd = "ipconfig /all" ' MS-Dos command-line example
PSPath = "C:\WINDOWS\PSTools\"
Cmmd = PSPath & "psexec.exe \\" & CptName & " -u " & UsrName & " -p " & UsrPWd & " " & PsxCmmd
Set oExec = WshShell.Exec(Cmmd)
Do While Not oExec.StdOut.AtEndOfStream
PsxReturn= oExec.StdOut.readall()
Loop
wScript.Echo "PSXReturn :" &PsxReturn
2 comments:
for me, it doesn't even work with 1.98. Nothing gets returned.
Hi Amir
a double "" have been removed.
you can try it again. ;-)
Post a Comment