Instead of the PsTools you'd use WMI in VBScript. Basic example:
server = "hostname"
Set wmi = GetObject("winmgmts://" & server & "/root/cimv2")
For Each obj In wmi.ExecQuery("SELECT * FROM wmi_class")
WScript.Echo obj.property
Next
Replace hostname
with the actual hostname, wmi_class
with the name of a WMI class, and property
with the name of an actual property of that class. Relevant classes for you are:
In some cases you may need to restrict the results returned by the query with a WHERE
clause:
SELECT * FROM wmi_class WHERE property = 'value'
See here and here for more information about WQL queries.
You can also use WMI to work on the registry. In your particular scenario, you'll need the EnumValues
method to enumerate the values of the registry key, and then query the values using the respective getter method:
Const HKLM = &H80000002
server = "hostname"
keyPath = "SYSTEM\CurrentControlSet\Control\CrashControl"
Set reg = GetObject("winmgmts:{impersonationLevel=impersonate}!//" _
& server & "/root/default:StdRegProv")
reg.EnumValues HKLM, keyPath, valueNames, valueTypes
For i = 0 To UBound(valueNames)
Select Case valueTypes(i)
Case REG_DWORD
reg.GetDWORDValue HKLM, keyPath, valueNames(i), value
WScript.Echo value
Case ...
...
End Select
Next
Note that unlike before you're using the namespace /root/default:StdRegProv
here.
Reading the server names from a CSV can be done using the FileSystemObject
methods. For a CSV with a structure like this:
hostname,address,...
host_A,10.23.42.1,...
host_B,10.23.42.2,...
...
you'd do something like this:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:\path\to\your.csv")
f.SkipLine 'skip header line
Do Until f.AtEndOfStream
server = Split(f.ReadLine)(0)
...
Loop
f.Close
Note that if the CSV is in Unicode format, you'll have to change the line
Set f = fso.OpenTextFile("C:\path\to\your.csv")
into this:
Set f = fso.OpenTextFile("C:\path\to\your.csv", 1, False, True)