Sign in to follow this  
Followers 0
NDog

Low level retrieve mobo manufacturer and model

6 posts in this topic

#1 ·  Posted (edited)

Without using WMI, registry or smbiosd, I want to retrieve the motherboard model and manufacturer.

I have used WMI, which doesn't work well with Windows 2008 Server, also not consistent

I have used smbiosd which doesn't work well with Windows 7

I have used registry which is inconsistent across platforms, sometimes its there, sometimes is not..

I am using 'CPU-Z' and this generates a txt file like this

DMI BIOS        
    vendor          American Megatrends Inc.
    version         080012
    date            05/23/2007

DMI System Information      
    manufacturer        ASUSTeK Computer INC.
    product         Z84J
    version         1.0
    serial          NB-1234567890
    UUID            {DC813111-9625-B3C7-2200-001BFCB3E5DA}

DMI Baseboard       
    vendor          ASUSTeK Computer INC.
    model           Z84J
    revision        1.00
    serial          NB-0123456789

DMI System Enclosure        
    manufacturer        ASUSTek Computer INC.
    chassis type        Notebook
    chassis serial      0x00000000

DMI Processor       
    manufacturer        Intel
    model           Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz
    clock speed     2000.0 MHz
    FSB speed       166.0 MHz
    multiplier      12.0x

How can I parse the values under DMI Baseboard, and retrieve the vendor and model into save the string into a variable, but only under DMI Baseboard and not another field?

Thanks

Edited by NDog

Share this post


Link to post
Share on other sites



Look up FileRead(), StringRegExp() in the helpfile.:huh2: Try hatching something together and post back if you run into problems.

Share this post


Link to post
Share on other sites

Look up FileRead(), StringRegExp() in the helpfile.:huh2: Try hatching something together and post back if you run into problems.

Hi smartee thanks for that

I tried this kind of code but how could I retrieve data only under this field? Thats the challenging part

$file = FileOpen("mysystem.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
        
    If $line = "DMI Baseboard       " Then ConsoleWrite($line& @LF) ; keep executing code under here until get to the next section
        
Wend

FileClose($file)

Thanks, I'm sure this is not too hard.

Share this post


Link to post
Share on other sites

Using the StringRegExp() method.

#Include<array.au3> ;; Only for the purpose of displaying the result
$sStr = FileRead("cpuz.txt")
$aDMI = StringRegExp($sStr, "(?is)dmi\s+baseboard\h*\v+(.+?)\v{3,}", 1)
If NOT @Error Then
    $aData = StringRegExp($aDMI[0], "(?i)(?:vendor|model)\h+(.+?)(?:\v)+", 3)
    If NOT @Error Then
        _ArrayDisplay($aData);; $aData[0] will contain the manufacturer and $aData[1] will contain the model number
    EndIf
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Using the StringRegExp() method.

Thanks for the working example GEOSoft, appreciate it. I will try to learn from this and ensure to incorporate in future text file parsing scripts.

Cheers

Share this post


Link to post
Share on other sites

No problem and since I'm in a benevolent mood today here is a shorter version.

#Include<array.au3> ;; Only for the purpose of displaying the result
$aData = StringRegExp(StringRegExpReplace(FileRead("cpuz.txt"), "(?is).+dmi\s+baseboard\h*\v+(.+?)\v{3,}.+", "$1"), "(?i)(?:vendor|model)\h+(.+?)(?:\v)+", 3)
If NOT @Error Then
    _ArrayDisplay($aData);; $aData[0] will contain the manufacturer and $aData[1] will contain the model number
EndIf

Just combined some functions into a single line of code. You should probably add an Else statement into the If/EndIf to handle any errors in case of no match though. A message box or a return value if you create it as a function will do the trick.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
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
Sign in to follow this  
Followers 0