It reports basic inventory data. If not, it reports unavailable systems and error state information. [Inventory objects collected include: OS, current logged-on user, manufacturer, model, service tag, processor type, memory, time zone, and daylight savings information
-----------------------------------------------------------------------------------------------------------------------------On error resume next
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://DC=DOMAIN,DC=local' " _
& "Where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
' Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
strComputer = objRecordSet.Fields("Name").Value
Set objShell = CreateObject("WScript.Shell")
strCommand = "%comspec% /c ping -n 3 -w 1000 " & strComputer & ""
Set objExecObject = objShell.Exec(strCommand)
'clears echo replies left in strText from the previous loop
strText=""
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadAll()
If Instr(strText, "Reply") > 0 Then
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_OperatingSystem")
Set colItems2 = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
' Wscript.Echo Err.Description
Set colItems3 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
Set colItems4 = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem in ColItems
strOS = objItem.Caption
Next
For Each objItem in colItems2
strDellTag = objItem.SerialNumber
strManu = objItem.Manufacturer
Next
For Each objItem in colitems3
strUserName = objItem.Username
strModel = objItem.Model
strRAM = objItem.TotalPhysicalMemory
strTimeZone = (objItem.CurrentTimeZone / 60)
strDayLightSavings = objItem.DaylightInEffect
Next
For Each objItem in colitems4
strProcessor = objItem.Name
Next
If Err.Number > 0 then
strErrorSystems = strComputer & ", " & strErrorSystems
else
Wscript.Echo "-------------------------------------------------------------"
Wscript.Echo "Computer Name: " & strComputer & ", " & strUserName
Wscript.Echo "-------------------------------------------------------------"
Wscript.Echo "Operating System: " & strOS
Wscript.Echo "Current User: " & strUserName
Wscript.Echo "::::"
WScript.Echo "Manufacturer: " & strManu
Wscript.Echo "Model: " & strModel
Wscript.Echo "Dell Service Tag: " & strDellTag
Wscript.Echo "Processor type: " & strProcessor
Wscript.Echo "RAM: " & strRAM
Wscript.Echo "Time Zone: " & strTimeZone
Wscript.Echo "Daylight Savings in effect: " & strDayLIghtSavings
Wscript.Echo "-------------------------------------------------------------"
end if
'flushes error code from the previous loop
Err.Clear
'
Else
'
UnavailableSystems = strComputer & ", " & UnavailableSystems
End If
Loop
objRecordSet.MoveNext
Loop
Wscript.Echo "The following systems were unavailable: " & UnavailableSystems
Wscript.Echo " "
Wscript.Echo "The following systems were on, but returned an error: " & strErrorSystems