PLSM
asked on
VBS run dos command problem
Hi.
srvinfo.exe is a W2K Resource Kit program that will list all sorts of information about local and remote computers. I cannot get the below VBS to work. It is supposed to open a dos prompt, run a command, write the results to a file, then close the dos prompt. Any suggestions?
--------------------------
Option Explicit
Dim fso, ts, strComputer, objShell, iReturn, objCommand
Const ForReading = 1
Set fso = WScript.CreateObject("Scri pting.File SystemObje ct")
' CHANGE THE PATH ON THE NEXT LINE
Set ts = fso.OpenTextFile("C:\Docum ents and Settings\user\Desktop\SDSe rvice\serv erlist.txt ", ForReading)
Do While Not ts.AtEndOfStream
strComputer = Trim(ts.ReadLine)
Set objCommand = WScript.CreateObject ("srvinfo -nf \\" & strComputer & " > C:\Documents and Settings\User\Desktop\SDSe rvice\Resu lts\" & strComputer & ".txt")
Set objShell = wscript.createObject("wscr ipt.shell" )
iReturn = objShell.Run ("%comspec% /C objCommand",1,True)
Loop
ts.Close
Set ts = Nothing
Set fso = Nothing
-------------------------- ---------
Thanks
PLSM
srvinfo.exe is a W2K Resource Kit program that will list all sorts of information about local and remote computers. I cannot get the below VBS to work. It is supposed to open a dos prompt, run a command, write the results to a file, then close the dos prompt. Any suggestions?
--------------------------
Option Explicit
Dim fso, ts, strComputer, objShell, iReturn, objCommand
Const ForReading = 1
Set fso = WScript.CreateObject("Scri
' CHANGE THE PATH ON THE NEXT LINE
Set ts = fso.OpenTextFile("C:\Docum
Do While Not ts.AtEndOfStream
strComputer = Trim(ts.ReadLine)
Set objCommand = WScript.CreateObject ("srvinfo -nf \\" & strComputer & " > C:\Documents and Settings\User\Desktop\SDSe
Set objShell = wscript.createObject("wscr
iReturn = objShell.Run ("%comspec% /C objCommand",1,True)
Loop
ts.Close
Set ts = Nothing
Set fso = Nothing
--------------------------
Thanks
PLSM
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CMD /C srvinfo...