Jump to content

BIOS Check


Recommended Posts

Hello all,

I am checking the BIOS version and MODEL # in PE. The functions to do this work perfect. If I pipe it out to a text file, i reads just like the INI listed below. When I do an INI read, it returns the 'default' key. It seems that IniRead doesn't pick up the model key when I read it using variables. Can anyone tell me what I am doing wrong? For some reasons, the strings don't match up. Thanks ahead of time!!

- redfive

BIOSUpdate.ini

[MODEL]
LatitudeD620=A08

BIOSUpdate.au3 code

$model = _GetPCModel('.')
$model = StringReplace($model, ' ', '')
$bios = _GetBIOSVer('.')

$biosread = IniRead(@ScriptDir & '\BIOSUpdate.ini', 'MODEL', $model, 'default')

If $biosread <> $bios Then
    MsgBox(0, '', 'needs to be updated')
Else
    MsgBox(0, '', 'doesnt need to be updated')
EndIf


Func _GetPCModel($strComputer)
    $wbemFlagReturnImmediately = 0x10
    $wbemFlagForwardOnly = 0x20
    $colItems = ""
;$strComputer = "sys0404"
    $Output=""
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    If IsObj($colItems) then
        For $objItem In $colItems
        $Output = $objItem.Name & @CRLF
   ;if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
        Return($Output)
        $Output=""
        Next
    Else
;~       Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" )
    Endif
EndFunc

Func _GetBIOSVer($strComputer)
    $wbemFlagReturnImmediately = 0x10
    $wbemFlagForwardOnly = 0x20
    $colItems = ""
;$strComputer = "sys0404"
    $Output=""
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    If IsObj($colItems) then
        For $objItem In $colItems
        $Output = $objItem.SMBIOSBIOSVERSION & @CRLF
   ;if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
        Return($Output)
        $Output=""
        Next
    Else
;~       Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" )
    Endif
EndFunc
Link to comment
Share on other sites

This shows up the problem:

$model = _GetPCModel('.')
ConsoleWrite("Debug: $model = '" & $model & "'" & @LF)
$model = StringReplace($model, ' ', '')
ConsoleWrite("Debug: $model = '" & $model & "'" & @LF)
$bios = _GetBIOSVer('.')
ConsoleWrite("Debug: $bios = '" & $bios & "'" & @LF)

$biosread = IniRead(@ScriptDir & '\BIOSUpdate.ini', 'MODEL', $model, 'default')
ConsoleWrite("Debug: $biosread = '" & $biosread & "'" & @LF)oÝ÷ Ù.­û§rبƫy§]xìm­ ,[ajܨ¹ªÞl¶¸©¦)à¡÷åj׫jëh×6$Output = $objItem.Name & @CRLF

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...