Okay I found the error. I coded it incorrectly for the WMI check in the main script. I was doing an If $WMIOkay then assumed WMI was okay and moved on. What can happen is that you can get an error and it would then return and fill that var with the error code which in affect would say that everything was okay and then move on to the next section of the script where it would then get another error trying to query the remote system and perform an abnormal end to the script.

I've modified the code now to check for a specific version and if found continue. If the version is older or an error occurs then it should report that and still keep going with the other computers in the list. I've also modified it to use UPPERCASE names for the computers.

I also updated the GetBIOSInfo UDF so that it would cleanly exit if there was an error as well and not cause the script to abonormally end.


Give this a try and let us know how it works out please.


Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $sComputers,$sComputer,$Details,$Detail
Dim $Alive,$WMIOkay,$CleanUp
$sComputers = ReadFile(@ScriptDir+'\'+'computer_list.txt')
For Each $sComputer In $sComputers
$sComputer = UCase(Trim($sComputer))
If $sComputer
$Alive = Ping($sComputer)
If $Alive
$WMIOkay = ConfirmWMI($sComputer)
If $WMIOkay > '1085'
$Details = GetBIOSInfo($sComputer)
For Each $Detail In $Details
If $Detail
'BIOS for ' +$sComputer +': ' + $Detail ?
EndIf
Next
Else
'WMI error on ' + $sComputer + ' ::Error results: ' +@ERROR + ' ' +@SERROR ?
EndIf
EndIf
EndIf
??
Next

Function GetBIOSInfo(optional $sComputer)
Dim $WMIService,$BIOSItems,$BIOSName,$BIOSVersion,$SMBIOSVersion
Dim $Item, $SerialNumber, $Manufacturer, $BIOSArray[4]
$sComputer=IIf(Not $sComputer,'','\\'+Join(Split($sComputer,'\'),'',3)+'\')
$WMIService = GetObject('winmgmts:{impersonationLevel=impersonate}!'+$sComputer+'root\cimv2')
If @ERROR $GetBIOSInfo = Val('&'+Right(DecToHex(@ERROR),4)) Exit $GetBIOSInfo EndIf
$BIOSItems = $WMIService.ExecQuery('Select * from Win32_BIOS where PrimaryBIOS = true',,48)
For Each $Item in $BIOSItems
If $Item
$BIOSName = Trim($Item.Name)
$BIOSVersion = Trim($Item.Version)
$SMBIOSVersion = Trim($Item.SMBIOSBIOSVersion)
$SerialNumber = Trim($Item.SerialNumber)
$Manufacturer = Trim($Item.Manufacturer)
EndIf
Next
$BIOSArray[0]=$BIOSName $BIOSArray[1]=$BIOSVersion $BIOSArray[2]=$SMBIOSVersion $BIOSArray[3]=$SerialNumber
$BIOSArray[4]=$Manufacturer
$GetBIOSInfo=$BIOSArray
EndFunction

Function ReadFile($file)
Dim $lf, $f, $_, $t
$lf=CHR(10)
$f=FreeFileHandle
$_=Open($f,$file)
If @ERROR Exit @ERROR EndIf
Do $t=$t+$lf+ReadLine($f) Until @ERROR
$_=Close($f)
$ReadFile=Split(SubStr($t,2),$lf)
EndFunction

Function Ping($sComputer)
Shell'%comspec% /c ping -n 1 '+$sComputer+' >nul'
$Ping = NOT @ERROR
EndFunction

Function ConfirmWMI(optional $sComputer)
Dim $objWMIService,$objWMISetting,$colWMISettings
$sComputer=IIf(Not $sComputer,'','\\'+Join(Split($sComputer,'\'),'',3)+'\')
$objWMIService = GetObject('winmgmts:{impersonationLevel=impersonate}!'+$sComputer+'root\cimv2')
If @ERROR
$ConfirmWMI = Val('&'+Right(DecToHex(@ERROR),4))
Exit $ConfirmWMI
EndIf
$colWMISettings = $objWMIService.ExecQuery('Select * from Win32_WMISetting')
For Each $objWMISetting In $colWMISettings
$ConfirmWMI = $objWMISetting.BuildVersion
Next
Exit $ConfirmWMI
EndFunction