Jump to content

Recommended Posts

Posted

This UDF gets basic information about BIOS. I'm author of this udf, and this is my first udf.

Example:

#include "BIOS.au3"

Example()

Func Example()
MsgBox(0, "", _
@CRLF & "BIOS Release Date...........| "& _BIOS_Release_Date() & _
@CRLF & "BIOS Vendor.....................| "&_BIOS_Vendor() & _
@CRLF & "BIOS Version....................| "& _BIOS_Version() & _
@CRLF & "System BIOS Version.......| "& _BIOS_SysBIOSVer() & _
@CRLF & "System Family..................| "& _BIOS_SysFamily() & _
@CRLF & "System Manufacturer......| "& _BIOS_SysManufacturer() & _
@CRLF & "System Product Name....| "& _BIOS_SysProdcName() & _
@CRLF & "System Version.................| "&_BIOS_SysVer()& _
@CRLF & "System SKU........................| "&_BIOS_SKU())
EndFunc

 

BIOS.au3

Posted (edited)

Witam cię Patryku na Forum AutoIt
I welcome you Patryk on AutoIt Forum.

I change your example a little bit:

#include "BIOS.au3"

Example()

Func Example()
    ConsoleWrite( _
            @CRLF & "BIOS Release Date.......| " & _BIOS_Release_Date() & _
            @CRLF & "BIOS Vendor.............| " & _BIOS_Vendor() & _
            @CRLF & "BIOS Version............| " & _BIOS_Version() & _
            @CRLF & "System BIOS Version.....| " & _BIOS_SysBIOSVer() & _
            @CRLF & "System Family...........| " & _BIOS_SysFamily() & _
            @CRLF & "System Manufacturer.....| " & _BIOS_SysManufacturer() & _
            @CRLF & "System Product Name.....| " & _BIOS_SysProdcName() & _
            @CRLF & "System Version..........| " & _BIOS_SysVer() & _
            @CRLF & "System SKU..............| " & _BIOS_SKU() & _
            "")
EndFunc    ;==>Example

Unfortunately, the result is not correct:

  Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\user\Downloads\BIOS_Example.au3" /UserParams    
+>00:23:59 Starting AutoIt3Wrapper v.15.920.938.4 SciTE v.3.6.2.0   Keyboard:00000415  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0415)  CodePage:65001  utf8.auto.check:4    # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\user\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\user\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.15.1)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\user\Downloads\BIOS_Example.au3
+>00:23:59 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\user\Downloads\BIOS_Example.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop

BIOS Release Date.......| 
BIOS Vendor.............| 
BIOS Version............| 
System BIOS Version.....| 
System Family...........| 
System Manufacturer.....| 
System Product Name.....| 
System Version..........| 
System SKU..............| +>00:24:00 AutoIt3.exe ended.rc:0
+>00:24:00 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.977

 

Expand  

 

I'm using Windows 10. Which version you are using ?
Can some body share results from different system ?

 

mLipok

 

EDIT:
Please also read:   Best coding practices   especially about https://www.autoitscript.com/wiki/Best_coding_practices#Names_of_Variables 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Isn't it possible to get "real" data from the BIOS like Windows does when it fills the registry?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

How about this (no UDF, just an example Script generated by Scriptomatic):

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "."

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\")
$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: " & $strBiosCharacteristics & @CRLF
      $strBIOSVersion = $objItem.BIOSVersion(0)
      $Output = $Output & "BIOSVersion: " & $strBIOSVersion & @CRLF
      $Output = $Output & "BuildNumber: " & $objItem.BuildNumber & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "CodeSet: " & $objItem.CodeSet & @CRLF
      $Output = $Output & "CurrentLanguage: " & $objItem.CurrentLanguage & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "IdentificationCode: " & $objItem.IdentificationCode & @CRLF
      $Output = $Output & "InstallableLanguages: " & $objItem.InstallableLanguages & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LanguageEdition: " & $objItem.LanguageEdition & @CRLF
      $strListOfLanguages = $objItem.ListOfLanguages(0)
      $Output = $Output & "ListOfLanguages: " & $strListOfLanguages & @CRLF
      $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "OtherTargetOS: " & $objItem.OtherTargetOS & @CRLF
      $Output = $Output & "PrimaryBIOS: " & $objItem.PrimaryBIOS & @CRLF
      $Output = $Output & "ReleaseDate: " & WMIDateStringToDate($objItem.ReleaseDate) & @CRLF
      $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF
      $Output = $Output & "SMBIOSBIOSVersion: " & $objItem.SMBIOSBIOSVersion & @CRLF
      $Output = $Output & "SMBIOSMajorVersion: " & $objItem.SMBIOSMajorVersion & @CRLF
      $Output = $Output & "SMBIOSMinorVersion: " & $objItem.SMBIOSMinorVersion & @CRLF
      $Output = $Output & "SMBIOSPresent: " & $objItem.SMBIOSPresent & @CRLF
      $Output = $Output & "SoftwareElementID: " & $objItem.SoftwareElementID & @CRLF
      $Output = $Output & "SoftwareElementState: " & $objItem.SoftwareElementState & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      $Output = $Output & "TargetOperatingSystem: " & $objItem.TargetOperatingSystem & @CRLF
      $Output = $Output & "Version: " & $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

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Win 7 64 bit Enterprise.
Had to use

Global $regkey = "HKLM\Hardware\Description\System\BIOS"

to make it work.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 2/27/2016 at 12:07 PM, water said:

Win 7 64 bit Enterprise.
Had to use

Global $regkey = "HKLM\Hardware\Description\System\BIOS"

to make it work.

Expand  

Win 10 Home

  Quote

BIOS Release Date.......| 03/23/2015
BIOS Vendor.............| LENOVO
BIOS Version............| CCCN12WW(V1.01)
System BIOS Version.....| 
System Family...........| IDEAPAD
System Manufacturer.....| LENOVO
System Product Name.....| 80MJ
System Version..........| Lenovo ideapad 100-15IBY
System SKU..............| LENOVO_MT_80MJ_BU_idea_FM_Lenovo ideapad 100-15IBY

 

Expand  

Thanks for this Registry Key findings

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 1 month later...
Posted
Hello
I am French
I'm sorry if wrote wrong :D
a solution ? 
 
#include-once
Global Const $version=1.01
Global $LastConfig=''
Global $regkey=''

If @OSVersion = "WIN_10" Or @OSVersion = "WIN_8.1" Or @OSVersion = "WIN_8" Or @OSVersion And @OSArch = "X64" Or @OSArch = "X86" Then
    $LastConfig = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\HardwareConfig", "LastConfig")
    $regkey="HKEY_LOCAL_MACHINE\SYSTEM\HardwareConfig\" & $LastConfig
Else
    $regkey="HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS"
EndIf

 

 

 

  • Moderators
Posted

@Amesam I cannot tell from your If string what criteria you're trying to nail down - you say if OSVersion = WIN_10 or WIN_8.1 Or WIN_8, but then you say Or @OSVersion (which is always going to evaluation True). Maybe something like this will get you started:

Local $LastConfig, $regkey

    Switch @OSVersion
        Case "WIN_10", "WIN_8.1", "WIN_8"
            $LastConfig = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\HardwareConfig", "LastConfig")
            $regkey="HKEY_LOCAL_MACHINE\SYSTEM\HardwareConfig\" & $LastConfig
        Case Else
            $regkey="HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS"
    EndSwitch

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Hi

Example WMI with the help of Scriptomatic and Win32_Bios class

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.14.2
    Author:         Amesam
    Script Function: WMI Hardwares Request
    Purpose: Get informations from the Hardwares
    Note: Every Function returns a MsgBox

    Win32_BIOS()

#ce ----------------------------------------------------------------------------

Global $objWMIService = ''
Global $colItems = ''
Global $strComputer = 'localhost'
Global $i
Global $OutputTitle = ''
Global $Output = ''
$OutputTitle &= "Computer: " & $strComputer & @CRLF
$OutputTitle &= "==========================================" & @CRLF

Win32_BIOS()

Func _WinClassesBios()
    $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", 0x10 + 0x20)
EndFunc   ;==>_WinClassesBios

Func Win32_BIOS()
    _WinClassesBios()
    If IsObj($colItems) Then 
        Local $Object_Flag = 0 
        For $objItem In $colItems 
            $Object_Flag = 1 
            $Output &= "WMI class output for Win32_BIOS" & @CRLF
            $Output &= "-----------------------------------------" & @CRLF & @CRLF
            $Output &= "BIOS : " & $objItem.BIOSVersion(0) & @CRLF
            $Output &= "Language Edition : " & $objItem.CurrentLanguage & @CRLF
            $Output &= "Maker : " & $objItem.Manufacturer & @CRLF
            $Output &= "Serial number : " & $objItem.SerialNumber & @CRLF
            _SMBIOSP()
            _BIOS_SoftwareElementState()
            $Output &= "Status: " & $objItem.Status & @CRLF & @CRLF
            $Output &= "Caractéristiques du BIOS : " & @CRLF
            $Output &= "-------------------------" & @CRLF
            $BCaracteristiques = ""
            _BIOSCharacteristics()
            If $Object_Flag = 0 Then $Output &= "WMI exit denied" & $OutputTitle & @CRLF
            If $Output = "" Then $Output &= "WMI Released: No WMI items found for the class: Win32_BIOS" & @CRLF
            If MsgBox(64, "", $Output) = 2 Then ExitLoop
        Next
    EndIf
EndFunc   ;==>Win32_BIOS

Func _SMBIOSP()
    _WinClassesBios()
    For $objItem In $colItems
        $SMBIOS = $objItem.SMBIOSPresent
        If $SMBIOS = True Then
            $Output &= "SMBIOS : Available " & @CRLF
            $Output &= "SMBIOS : Version of the measuring system " & $objItem.SMBIOSBIOSVersion & @CRLF
        Else
            $Output &= "SMBIOS Non Available : " & $objItem.SMBIOSPresent & @CRLF
        EndIf
    Next
EndFunc   ;==>_SMBIOSP

Func _BIOS_SoftwareElementState()
    _WinClassesBios()
    For $objItem In $colItems
        $SoftwareElementState = $objItem.SoftwareElementState
        Switch $SoftwareElementState
            Case 0
                $Output &= "State of a software element : Déployable (0)" & @CRLF
            Case 1
                $Output &= "State of a software element : Installable (1)" & @CRLF
            Case 2
                $Output &= "State of a software element : Executable (2)" & @CRLF
            Case 3
                $Output &= "State of a software element : Running  (3)" & @CRLF
        EndSwitch
    Next
EndFunc   ;==>_BIOS_SoftwareElementState

Func _BIOSCharacteristics()
    _WinClassesBios()
    For $objItem In $colItems
        $strBiosCharacteristics = $objItem.BiosCharacteristics
        For $Bios_Crtrt In $strBiosCharacteristics
            Switch $Bios_Crtrt
                Case 0
                    $Output &= "- Reserved  (0)" & @CRLF
                Case 1
                    $Output &= "- Reserved  (1)" & @CRLF
                Case 2
                    $Output &= "- Unknown  (2)" & @CRLF
                Case 3
                    $Output &= "- BIOS Characteristics Not Supported  (3)" & @CRLF
                Case 4
                    $Output &= "- ISA is supported (4)" & @CRLF
                Case 5
                    $Output &= "- MCA is supported (5)" & @CRLF
                Case 6
                    $Output &= "- EISA is supported (6)" & @CRLF
                Case 7
                    $Output &= "- PCI is supported (7)" & @CRLF
                Case 8
                    $Output &= "- PC Card (PCMCIA) is supported (8)" & @CRLF
                Case 9
                    $Output &= "- Plug and Play is supported (9)" & @CRLF
                Case 10
                    $Output &= "- APM is supported (10)" & @CRLF
                Case 11
                    $Output &= "- BIOS is Upgradeable (Flash) (11)" & @CRLF
                Case 12
                    $Output &= "- BIOS shadowing is allowed (12)" & @CRLF
                Case 13
                    $Output &= "- VL-VESA is supported(13)" & @CRLF
                Case 14
                    $Output &= "- ESCD support is available  (14)" & @CRLF
                Case 15
                    $Output &= "- Boot from CD is supported (15)" & @CRLF
                Case 16
                    $Output &= "- Selectable Boot is supported (16)" & @CRLF
                Case 17
                    $Output &= "- BIOS ROM is socketed (17)" & @CRLF
                Case 18
                    $Output &= "- Boot De PC Card (PCMCIA) is supported (18)" & @CRLF
                Case 19
                    $Output &= "- EDD (Enhanced Disk Drive) Spécification is supported (19)" & @CRLF
                Case 20
                    $Output &= "- Int 13h - Floppy japonais pour NEC 9800 1.2mb (3,5 \ , 1k octets / secteur, 360 RPM) is supported (20) " & @CRLF
                Case 21
                    $Output &= "- Int 13h - Floppy japonais pour Toshiba 1.2mb (3,5 \ , 360 RPM) is supported (21) " & @CRLF
                Case 22
                    $Output &= "- Int 13h - 5,25 \  / 360 KB Floppy services are supported (22) " & @CRLF
                Case 23
                    $Output &= "- Int 13h - 5,25 \  / 1.2MB services Floppy are supported (23) " & @CRLF
                Case 24
                    $Output &= "- Int 13h - 3,5 \  / 720 KB Floppy services are supported (24) " & @CRLF
                Case 25
                    $Output &= "- Int 13h - 3,5 \  / 2.88 MB Floppy services are supported(25) " & @CRLF
                Case 26
                    $Output &= "- Int 5h, Print Screen Service is supporte (26)" & @CRLF
                Case 27
                    $Output &= "- Int 9h, 8042 Keyboard services are supported (27)" & @CRLF
                Case 28
                    $Output &= "- Int 14h, Serial Services are supported (28)" & @CRLF
                Case 29
                    $Output &= "- Int 17h, printer services are supported (29)" & @CRLF
                Case 30
                    $Output &= "- Int 10h, CGA/Mono Video Services are supported (30)" & @CRLF
                Case 31
                    $Output &= "- NEC PC-98 (31)" & @CRLF
                Case 32
                    $Output &= "- ACPI is supported (32)" & @CRLF
                Case 33
                    $Output &= "- Legacy USB is supported (33)" & @CRLF
                Case 34
                    $Output &= "- AGP is supported (34)" & @CRLF
                Case 35
                    $Output &= "- I2O boot is supported (35)" & @CRLF
                Case 36
                    $Output &= "- LS-120 boot is supported (36)" & @CRLF
                Case 37
                    $Output &= "- ATAPI ZIP Drive boot is supported  (37)" & @CRLF
                Case 38
                    $Output &= "- 1394 boot is supported (38)" & @CRLF
                Case 39
                    $Output &= "- Smart Battery supported (39)" & @CRLF
                Case 40 To 47
                    $Output &= "- Reserved for BIOS vendor (40 - 47)" & @CRLF
                Case 48 To 63
                    $Output &= "- Reserved for system vendor (48 - 63)" & @CRLF
            EndSwitch
        Next
    Next

EndFunc   ;==>_BIOSCharacteristics

 

 

 

Posted (edited)

powershell shrinks that a bit, and get-wmiobject seems to go back pretty far

#include <array.au3>

$iPid = run("cmd /c powershell get-wmiobject win32_BIOS" , "" , @SW_HIDE , $stdout_child)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
 WEnd

 $aOut = stringsplit($sOutput , @LF , 2)

_ArrayDelete($aOut , "0-1 ; 7-10")
 _Arraydisplay($aOut)

 

Edited by iamtheky

  Reveal hidden contents

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
  • Recently Browsing   0 members

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