' WMiBiosString.vbs ' Returns BIOS data from an array of hosts Computers = Array("aka1", "mort", "jimbo") On Error Resume Next For each Computer in Computers If IsConnectible(Computer, "", "") Then WScript.Echo WmiBiosString(Computer) If Err.Number <> 0 Then WScript.Echo "Error accessing", Computer, _ ":", Err.Number, Err.Description Err.Clear End If Else WScript.Echo "Could not ping", Computer End If Next On Error Resume Next Function WmiBiosString(Host) Set WmiSvc = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & Host & "\root\cimv2") Set BIOSes = WmiSvc.ExecQuery _ ("Select * from Win32_BIOS") For each BIOS in BIOSes aTmp = Array( Host, BIOS.BuildNumber, _ BIOS.Manufacturer, _ BIOS.Name, _ BIOS.PrimaryBIOS, _ BIOS.ReleaseDate, _ BIOS.SerialNumber, _ BIOS.SMBIOSBIOSVersion, _ BIOS.SMBIOSMajorVersion, _ BIOS.SMBIOSMinorVersion, _ BIOS.SMBIOSPresent, _ BIOS.Status, _ BIOS.Version) Next ' build with loop instead of join ' helps with null entries sTmp = aTmp(0) For i = 1 to UBound(aTmp) If TypeName(aTmp(i)) = "Null" then aTmp(i) = "" sTmp = sTmp & vbTab & CStr(aTmp(i)) Next WmiBiosString = sTmp End Function Function IsConnectible(sHost, iPings, iTO) ' Returns True or False based on the output from ping.exe ' ' Author: Alex Angelopoulos/Torgeir Bakken ' Works an "all" WSH versions ' sHost is a hostname or IP ' iPings is number of ping attempts ' iTO is timeout in milliseconds ' if values are set to "", then defaults below used If iPings = "" Then iPings = 2 If iTO = "" Then iTO = 750 Const OpenAsDefault = -2 Const FailIfNotExist = 0 Const ForReading = 1 Set oShell = CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") sTemp = oShell.ExpandEnvironmentStrings("%TEMP%") sTempFile = sTemp & "\runresult.tmp" oShell.Run "%comspec% /c ping -n " & iPings & " -w " & iTO _ & " " & sHost & ">" & sTempFile, 0 , True Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, _ FailIfNotExist, OpenAsDefault) sResults = fFile.ReadAll fFile.Close oFSO.DeleteFile(sTempFile) Select Case InStr(sResults,"TTL=") Case 0 IsConnectible = False Case Else IsConnectible = True End Select End Function