mbkowns 0 Posted September 18, 2007 I wondering if there is a cool way to pull the motherboard serial using AutoIt. The way we join the domain at work is using the serial number but if I could script this it would make things easier. Let me know if its possible -Kyle Share this post Link to post Share on other sites
PsaltyDS 42 Posted September 18, 2007 (edited) That sounded useful, so I did a demo based on a Technet article: Retrieving Information About the BIOS$sMsg = "Motherboard serial number: " & _BiosGetSerialNumber() MsgBox(64, "Results", $sMsg) Func _BiosGetSerialNumber() Local $sRET, $strComputer = @ComputerName Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") Local $colBIOS = $objWMIService.ExecQuery ("SELECT * FROM Win32_BIOS") For $objBIOS In $colBIOS $sRET = $objBIOS.SerialNumber Next If $sRET <> "" Then Return $sRET Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_BiosGetSerialNumberoÝ÷ Ù8^~e£§Êz±©e¶½¨¥i¹^r«iË^®+-ËÛÚç¬~º&¶ ä¢×«mæ«¶'%yÈyجw(^µè§¶i¹^¡÷!j¶µêâ²Ø²Ê&j|¢g®¦«¨¶éÝyø§yÚ®¢Ú+ªê-¢ëh~¶§ê®¢Ö®¶sbb33c¶d&÷46%³3UÒ²'&öb$õ26&7FW&7F70¢b33c¶d&÷46%³5ÒÒgV÷C´$õ26&7FW&7F72æ÷B7W÷'FVBgV÷C°¢b33c¶d&÷46%³EÒÒgV÷C´427W÷'FVBgV÷C°¢b33c¶d&÷46%³eÒÒgV÷C´T427W÷'FVBgV÷C°¢b33c¶d&÷46%³uÒÒgV÷Cµ427W÷'FVBgV÷C°¢b33c¶d&÷46%³ÒÒgV÷Cµ26&B4Ô427W÷'FVBgV÷C°¢b33c¶d&÷46%³ÒÒgV÷CµÇVræBÆ27W÷'FVBgV÷C°¢b33c¶d&÷46%³ÒÒgV÷C´Ò27W÷'FVBgV÷C°¢b33c¶d&÷46%³ÒÒgV÷C´$õ22Ww&F&ÆRfÆ6gV÷C°¢b33c¶d&÷46%³UÒÒgV÷C´&ö÷Bg&öÒ4B27W÷'FVBgV÷C°¢b33c¶d&÷46%³eÒÒgV÷Cµ6VÆV7F&ÆR&ö÷B27W÷'FVBgV÷C°¢b33c¶d&÷46%³uÒÒgV÷C´$õ2$ôÒ26ö6¶WFVBgV÷C°¢b33c¶d&÷46%³ÒÒgV÷C´&ö÷Bg&öÒ26&B4Ô427W÷'FVBgV÷C°¢b33c¶d&÷46%³3%ÒÒgV÷C´57W÷'FVBgV÷C°¢b33c¶d&÷46%³3EÒÒgV÷C´u27W÷'FVBgV÷C° ¢b33c·7G$6ö×WFW"Ò6ö×WFW$æÖP¢b33c¶ö&¥tÔ6W'f6RÒö&¤vWBgV÷C·væÖv×G3§¶×W'6öæFöäÆWfVÃÖ×W'6öæFWÒb333²b3#²b3#²gV÷C²fײb33c·7G$6ö×WFW"fײgV÷C²b3#·&ö÷Bb3#¶6×c"gV÷C²¢b33c¶6öÄ$õ2Òb33c¶ö&¥tÔ6W'f6RäWV5VW'gV÷Cµ4TÄT5B¢e$ôÒvã3%ô$õ2gV÷C²¢b33c·4×6rÒgV÷C´$õ2&÷W'FW2f÷"6ö×WFW"ÒgV÷C²fײb33c·7G$6ö×WFW"fײ5$Ä`¢b33c·4×6rf׳ÒD"fײgV÷C´$õ26&7FW&7F72ÒgV÷C²fײ5$Ä`¤f÷"b33c¶ö&¤$õ2âb33c¶6öÄ$õ0 f÷"b33c¶çD6&7FW&7F2âb33c¶ö&¤$õ2ä&÷46&7FW&7F70 bb33c¶çD6&7FW&7F2fwC²æBb33c¶çD6&7FW&7F2fÇC²T&÷VæBb33c¶d&÷46"ÒFVà b7G&æu7G&u2b33c¶d&÷46%²b33c¶çD6&7FW&7F5ÒÂÒgV÷C²gV÷C²FVà b33c·4×6rf׳ÒD"fײD"fײb33c¶çD6&7FW&7F2fײgV÷C²ÒfÇCµVæ¶æ÷vâÒæòFVfæFöâfwC²gV÷C²fײ5$Ä` VÇ6P b33c·4×6rf׳ÒD"fײD"fײb33c¶çD6&7FW&7F2fײgV÷C²ÒgV÷C²fײb33c¶d&÷46%²b33c¶çD6&7FW&7F5Òfײ5$Ä` VæD` VÇ6P b33c·4×6rf׳ÒD"fײD"fײb33c¶çD6&7FW&7F2fײgV÷C²ÒfÇCµVæ¶æ÷vâÒ÷WBöb&ævRfwC²gV÷C²fײ5$Ä` VæD` æW@ b33c·4×6rf׳ÒD"fײgV÷C´$õ2fÇVW2ÒgV÷C²fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷C´'VÆBçVÖ&W"ÒgV÷C²fײb33c¶ö&¤$õ2ä'VÆDçVÖ&W"fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷C´7W'&VçBÆæwVvRÒgV÷C²fײb33c¶ö&¤$õ2ä7W'&VçDÆæwVvRfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷C´ç7FÆÆ&ÆRÆæwVvW2ÒgV÷C²fײb33c¶ö&¤$õ2äç7FÆÆ&ÆTÆæwVvW2fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷C´ÖçVf7GW&W"ÒgV÷C²fײb33c¶ö&¤$õ2äÖçVf7GW&W"fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷C´æÖRÒgV÷C²fײb33c¶ö&¤$õ2äæÖRfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ&Ö'$õ2ÒgV÷C²fײb33c¶ö&¤$õ2å&Ö'$õ2fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ&VÆV6RFFRÒgV÷C²fײb33c¶ö&¤$õ2å&VÆV6TFFRfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ6W&ÂçVÖ&W"ÒgV÷C²fײb33c¶ö&¤$õ2å6W&ÄçVÖ&W"fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ4Ô$õ2fW'6öâÒgV÷C²fײb33c¶ö&¤$õ2å4Ô$õ4$õ5fW'6öâfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ4Ô$õ2Ö¦÷"fW'6öâÒgV÷C²fײb33c¶ö&¤$õ2å4Ô$õ4Ö¦÷%fW'6öâfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ4Ô$õ2Öæ÷"fW'6öâÒgV÷C²fײb33c¶ö&¤$õ2å4Ô$õ4Öæ÷%fW'6öâfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ4Ô$õ2&W6VçBÒgV÷C²fײb33c¶ö&¤$õ2å4Ô$õ5&W6VçBfײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷Cµ7FGW2ÒgV÷C²fײb33c¶ö&¤$õ2å7FGW2fײ5$Ä` b33c·4×6rf׳ÒD"fײD"fײgV÷CµfW'6öâÒgV÷C²fײb33c¶ö&¤$õ2åfW'6öâfײ5$Ä`¤æW@ ¤×6t&÷cBÂgV÷C´$õ2&÷W'FW2gV÷C²Âb33c·4×6r Edit: Bitten by the forum edit bug...again! GRRRRrrrrrr! Edited September 18, 2007 by PsaltyDS 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 Share this post Link to post Share on other sites
rover 50 Posted September 18, 2007 (edited) Hi PsaltyDS The ScriptOmatic program converts WMI to AutoIt code WMI ScriptOMatic tool for AutoIt by SvenP the resulting text always badly needs formatting (@Tabs), for display anyway Computer Info UDF's by JSThePatriot expandcollapse popup; Generated by AutoIt Scriptomatic ; BIOS Characteristics $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $strBiosCharacteristics = $objItem.BiosCharacteristics(0) $Output = $Output & "BiosCharacteristics: " &@TAB&@TAB&$strBiosCharacteristics & @CRLF $strBIOSVersion = $objItem.BIOSVersion(0) $Output = $Output & "BIOSVersion: " &@TAB&@TAB& $strBIOSVersion & @CRLF $Output = $Output & "BuildNumber: " &@TAB& $objItem.BuildNumber & @CRLF $Output = $Output & "Caption: " &@TAB&@TAB&@TAB& $objItem.Caption & @CRLF $Output = $Output & "CodeSet: " &@TAB& $objItem.CodeSet & @CRLF $Output = $Output & "CurrentLanguage: " &@TAB&@TAB& $objItem.CurrentLanguage & @CRLF $Output = $Output & "Description: " &@TAB&@TAB& $objItem.Description & @CRLF $Output = $Output & "IdentificationCode: " &@TAB& $objItem.IdentificationCode & @CRLF $Output = $Output & "InstallableLanguages: " &@TAB& $objItem.InstallableLanguages & @CRLF $Output = $Output & "InstallDate: " &@TAB&@TAB& WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "LanguageEdition: " &@TAB& $objItem.LanguageEdition & @CRLF $strListOfLanguages = $objItem.ListOfLanguages(0) $Output = $Output & "ListOfLanguages: " &@TAB&@TAB& $strListOfLanguages & @CRLF $Output = $Output & "Manufacturer: " &@TAB&@TAB& $objItem.Manufacturer & @CRLF $Output = $Output & "Name: " &@TAB&@TAB&@TAB& $objItem.Name & @CRLF $Output = $Output & "OtherTargetOS: " &@TAB& $objItem.OtherTargetOS & @CRLF $Output = $Output & "PrimaryBIOS: " &@TAB&@TAB& $objItem.PrimaryBIOS & @CRLF $Output = $Output & "ReleaseDate: " &@TAB&@TAB& WMIDateStringToDate($objItem.ReleaseDate) & @CRLF $Output = $Output & "SerialNumber: " &@TAB&@TAB& $objItem.SerialNumber & @CRLF $Output = $Output & "SMBIOSBIOSVersion: " &@TAB& $objItem.SMBIOSBIOSVersion & @CRLF $Output = $Output & "SMBIOSMajorVersion: " &@TAB& $objItem.SMBIOSMajorVersion & @CRLF $Output = $Output & "SMBIOSMinorVersion: " &@TAB& $objItem.SMBIOSMinorVersion & @CRLF $Output = $Output & "SMBIOSPresent: " &@TAB&@TAB& $objItem.SMBIOSPresent & @CRLF $Output = $Output & "SoftwareElementID: " &@TAB& $objItem.SoftwareElementID & @CRLF $Output = $Output & "SoftwareElementState: " &@TAB& $objItem.SoftwareElementState & @CRLF $Output = $Output & "Status: " &@TAB&@TAB&@TAB& $objItem.Status & @CRLF $Output = $Output & "TargetOperatingSystem: " &@TAB& $objItem.TargetOperatingSystem & @CRLF $Output = $Output & "Version: " &@TAB&@TAB&@TAB& $objItem.Version & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_BIOS" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Edited September 18, 2007 by rover I see fascists... Share this post Link to post Share on other sites
PsaltyDS 42 Posted September 18, 2007 Hi PsaltyDS The ScriptOmatic program converts WMI to AutoIt code WMI ScriptOMatic tool for AutoIt by SvenP the resulting text always badly needs formatting (@Tabs), for display anyway Computer Info UDF's by JSThePatriot This part only displays the first of many BIOS characteristics, some of which are quite significant, like whether PC Card or ACPI are supported. $strBiosCharacteristics = $objItem.BiosCharacteristics(0) $Output = $Output & "BiosCharacteristics: " &@TAB&@TAB&$strBiosCharacteristics & @CRLF Run the second of the two scripts I posted for the full list, properly formatted. Note: Due to the forum edit bug, I couldn't tweak that one. The first line should have GLOBAL in front of it to declare the array. Please, Jon... fix the forum edit bug... 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 Share this post Link to post Share on other sites
mbkowns 0 Posted September 18, 2007 Dang thats for that responce! Ill try this out and let you know. Share this post Link to post Share on other sites
rover 50 Posted September 20, 2007 I stand corrected PsaltyDs scriptomatic is such a great resource, that i've recommended this to several forum users already when I see what they're asking for can be generated by scriptomatic. the forum editor.....hmm... do you get the random characters corrupting your text too? I see fascists... Share this post Link to post Share on other sites
PsaltyDS 42 Posted September 20, 2007 the forum editor.....hmm...do you get the random characters corrupting your text too?Yes. The AutoIt tag interpreter at the forum server scrambles RTF format text somehow in certain situations. Jon is aware of it, and will hopefully have the time or help needed to fix it someday. As a work-around, if you don't use the AutoIt tags, you shouldn't see the problem. 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 Share this post Link to post Share on other sites