redfive19 Posted August 14, 2007 Share Posted August 14, 2007 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 expandcollapse popup$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 More sharing options...
DW1 Posted August 14, 2007 Share Posted August 14, 2007 does $model = exactly "LatitudeD620"? AutoIt3 Online Help Link to comment Share on other sites More sharing options...
redfive19 Posted August 14, 2007 Author Share Posted August 14, 2007 yes actually to write the INI file, I did a FileWrite with the $model to make the INI Link to comment Share on other sites More sharing options...
DW1 Posted August 14, 2007 Share Posted August 14, 2007 what if you use Iniwrite to make the ini file? AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 14, 2007 Share Posted August 14, 2007 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 More sharing options...
weaponx Posted August 14, 2007 Share Posted August 14, 2007 I was just going to post that same answer. I noticed there was whitespace or something in the model name because it worked when I hardcoded the model in for $model. Link to comment Share on other sites More sharing options...
redfive19 Posted August 14, 2007 Author Share Posted August 14, 2007 I feel dumb.....I got those functions off of someone's post and it was probably there for their purpose. BUT AGAIN, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now