Nicht angemeldet.
Hier können Sie Ihre eigenen Skripte und UDF's veröffentlichen undanderen zum Download anbieten oder von anderen herunterladen
#cs This UDF is made for using the Windows Management Instrumentation in AutoIt V.3 The content of this work is licensed under Creative Commons license. Der Inhalt dieses Werkes ist lizensiert unter der Creative Commons Lizenz. #ce ; Last Change 16.06.2010 ; #INDEX# ========================================================================================= ; Win32_BIOS Functions ; ~~~~~~~~~~~~~~~~~~~~ ; _WinWMI_BIOS_GetCharacteristics() ; _WinWMI_BIOS_GetVersion() ; _WinWMI_BIOS_GetInformation() ; _WinWMI_BIOS_GetLanguages() ; ; ================================================================================================= ; #CONSTANTS# ===================================================================================== ; See http://msdn.microsoft.com/de-de/library/ms974579.aspx for further information (German) ;~ Global Const $wbemFlagReturnImmediately = 0x10 ;~ Global Const $wbemFlagForwardOnly = 0x20 ; ================================================================================================= ; #FUNCTION# ====================================================================================== ; Name .............: _WinWMI_BIOS_GetCharacteristics() ; Description ......: Returns an Array of BIOS characteristics supported by the system as defined by the System Management BIOS Reference Specification. ; Syntax ...........: _WinWMI_BIOS_GetCharacteristics(Const[ $sComputer = "127.0.0.1"]) ; Parameters .......: Const $sComputer - [optional] Target Computer (default:"127.0.0.1") ; Return values ....: Success - Returns an Array with the BiosCharacteristics ; Failure - 0 Sets @error to: ; |-1 Connection failed ; |-2 WMI Class not found/no access ; |-3 No matches or more than one found ; Author ...........: Mahagon ; Link .............: http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx ; Link (German).....: http://www.scriptinternals.de/new/ger/support/Internal/WMI_Win32_BIOS.htm ; Au3.api extension.: _WinWMI_BIOS_GetCharacteristics( [ "Target Computer"] ) Returns an Array with the BIOS characteristics. ( Requires: #include <WinWMI.au3> ) ; ================================================================================================= Func _WinWMI_BIOS_GetCharacteristics(Const $sComputer = "127.0.0.1") $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\CIMV2") If IsObj($oWMI) = 0 Then Return SetError(-1, @error, 0) $oList = $oWMI.ExecQuery("SELECT BiosCharacteristics FROM Win32_BIOS", "WQL") If IsObj($oList) = 0 Then Return SetError(-2, @error, 0) If $oList.Count <> 1 Then Return SetError(-3, @error, 0) Local $sBiosCharacteristics = "" For $oItem In $oList For $iCount = 0 To UBound($oItem.BiosCharacteristics) - 1 Switch $oItem.BiosCharacteristics($iCount) Case 0 $sBiosCharacteristics &= "reserved|" Case 1 $sBiosCharacteristics &= "reserved|" Case 2 $sBiosCharacteristics &= "unknown|" Case 3 $sBiosCharacteristics &= "BIOS characteristics not supported|" Case 4 $sBiosCharacteristics &= "ISA supported|" Case 5 $sBiosCharacteristics &= "MCA supported|" Case 6 $sBiosCharacteristics &= "EISA supported|" Case 7 $sBiosCharacteristics &= "PCI supported|" Case 8 $sBiosCharacteristics &= "PC Card (PCMCIA) supported|" Case 9 $sBiosCharacteristics &= "Plug and Play supported|" Case 10 $sBiosCharacteristics &= "APM is supported|" Case 11 $sBiosCharacteristics &= "BIOS upgradable (Flash)|" Case 12 $sBiosCharacteristics &= "BIOS shadowing allowed|" Case 13 $sBiosCharacteristics &= "VL-VESA supported|" Case 14 $sBiosCharacteristics &= "ESCD support available|" Case 15 $sBiosCharacteristics &= "Boot from CD supported|" Case 16 $sBiosCharacteristics &= "Selectable boot supported|" Case 17 $sBiosCharacteristics &= "BIOS ROM socketed|" Case 18 $sBiosCharacteristics &= "Boot from PC card (PCMCIA) supported|" Case 19 $sBiosCharacteristics &= "EDD (Enhanced Disk Drive) specification supported|" Case 20 $sBiosCharacteristics &= "Int 13h, Japanese Floppy for NEC 9800 1.2mb (3.5, 1k b/s, 360 RPM) supported|" Case 21 $sBiosCharacteristics &= "Int 13h, Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) supported|" Case 22 $sBiosCharacteristics &= "Int 13h, 5.25 / 360 KB floppy services supported|" Case 23 $sBiosCharacteristics &= "Int 13h, 5.25 /1.2MB floppy services supported|" Case 24 $sBiosCharacteristics &= "Int 13h 3.5 / 720 KB floppy services supported|" Case 25 $sBiosCharacteristics &= "Int 13h, 3.5 / 2.88 MB floppy services supported|" Case 26 $sBiosCharacteristics &= "Int 5h, print screen service supported|" Case 27 $sBiosCharacteristics &= "Int 9h, 8042 keyboard services supported|" Case 28 $sBiosCharacteristics &= "Int 14h, serial services supported|" Case 29 $sBiosCharacteristics &= "Int 17h, printer services supported|" Case 30 $sBiosCharacteristics &= "Int 10h, CGA/Mono video aervices supported|" Case 31 $sBiosCharacteristics &= "NEC PC-98|" Case 32 $sBiosCharacteristics &= "ACPI supported|" Case 33 $sBiosCharacteristics &= "USB Legacy supported|" Case 34 $sBiosCharacteristics &= "AGP supported|" Case 35 $sBiosCharacteristics &= "I2O boot supported|" Case 36 $sBiosCharacteristics &= "LS-120 boot supported|" Case 37 $sBiosCharacteristics &= "ATAPI ZIP drive boot supported|" Case 38 $sBiosCharacteristics &= "1394 boot supported|" Case 39 $sBiosCharacteristics &= "Smart battery supported|" EndSwitch If $oItem.BiosCharacteristics($iCount) > 40 And $oItem.BiosCharacteristics($iCount) < 47 Then $sBiosCharacteristics &= "Reserved for BIOS vendor|" If $oItem.BiosCharacteristics($iCount) > 48 Then $sBiosCharacteristics &= "Reserved for system vendor|" Next Next Return StringSplit(StringTrimRight($sBiosCharacteristics, 1), "|", 2) EndFunc ;==>_WinWMI_BIOS_GetCharacteristics ; #FUNCTION# ====================================================================================== ; Name .............: _WinWMI_BIOS_GetVersion() ; Description ......: Description ; Syntax ...........: _WinWMI_BIOS_GetVersion(Const[ $sComputer = "127.0.0.1"]) ; Parameters .......: Const $sComputer - [optional] Target Computer (default:"127.0.0.1") ; Return values ....: Success - Returns an Array with the BiosVersion ; Failure - 0 Sets @error to: ; |-1 Connection failed ; |-2 WMI Class not found/no access ; |-3 No matches or more than one found ; Author ...........: Mahagon ; Link .............: http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx ; Link (German).....: http://www.scriptinternals.de/new/ger/support/Internal/WMI_Win32_BIOS.htm ; Au3.api extension.: _WinWMI_BIOS_GetVersion( [ "Target Computer"] ) Returns an Array with the BIOSVersion. ( Requires: #include <WinWMI.au3> ) ; ================================================================================================= Func _WinWMI_BIOS_GetVersion(Const $sComputer = "127.0.0.1") $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\CIMV2") If IsObj($oWMI) = 0 Then Return SetError(-1, @error, 0) $oList = $oWMI.ExecQuery("SELECT BIOSVersion FROM Win32_BIOS", "WQL") If IsObj($oList) = 0 Then Return SetError(-2, @error, 0) If $oList.Count <> 1 Then Return SetError(-3, @error, 0) For $oItem In $oList Local $aReturn[UBound($oItem.BIOSVersion)] For $iCount = 0 To UBound($oItem.BIOSVersion) - 1 $aReturn[$iCount] = $oItem.BIOSVersion($iCount) Next Next Return $aReturn EndFunc ;==>_WinWMI_BIOS_GetVersion ; #FUNCTION# ====================================================================================== ; Name .............: _WinWMI_BIOS_GetInformation() ; Description ......: Returns the non-Array attributes of the Win32_BIOS Class in an 1D Array ; Syntax ...........: _WinWMI_BIOS_GetInformation(Const[ $sFields = "SMBIOSBIOSVersion", Const[ $sComputer = "127.0.0.1"]]) ; Parameters .......: Const $sFields - [optional] BIOSinformation seperated by comma (default:"SMBIOSBIOSVersion") ; Const $sComputer - [optional] Target Computer (default:"127.0.0.1") ; Return values ....: Success - Returns an Array with the non-Array attributes of the Win32_BIOS Class ; Failure - 0 Sets @error to: ; |-1 Connection failed ; |-2 WMI Class not found/no access ; |-3 No matches found ; Author ...........: Mahagon ; Link .............: http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx ; Link (German).....: http://www.scriptinternals.de/new/ger/support/Internal/WMI_Win32_BIOS.htm ; Au3.api extension.: _WinWMI_BIOS_GetInformation( [ [ "Fields" [, "Target Computer"]]] ) Returns the non-Array attributes of the Win32_BIOS Class in an 1D Array. ( Requires: #include <WinWMI.au3> ) ; ================================================================================================= Func _WinWMI_BIOS_GetInformation(Const $sFields = "SMBIOSBIOSVersion", Const $sComputer = "127.0.0.1") $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\CIMV2") If IsObj($oWMI) = 0 Then Return SetError(-1, @error, 0) $oList = $oWMI.ExecQuery("SELECT " & $sFields & " FROM Win32_BIOS", "WQL") If IsObj($oList) = 0 Then Return SetError(-2, @error, 0) $aFields = StringSplit($sFields, ",", 2) If $oList.Count = 0 Then Return SetError(-3, @error, 0) Local $aReturn[UBound($aFields)] For $oItem In $oList With $oItem For $iFields = 0 To UBound($aFields) - 1 Switch $aFields[$iFields] Case "BuildNumber" $aReturn[$iFields] = .BuildNumber Case "Caption" $aReturn[$iFields] = .Caption Case "CodeSet" $aReturn[$iFields] = .CodeSet Case "CurrentLanguage" $aReturn[$iFields] = .CurrentLanguage Case "Description" $aReturn[$iFields] = .Description Case "IdentificationCode" $aReturn[$iFields] = .IdentificationCode Case "InstallableLanguages" $aReturn[$iFields] = .InstallableLanguages Case "InstallDate" $aReturn[$iFields] = .InstallDate Case "LanguageEdition" $aReturn[$iFields] = .LanguageEdition Case "Manufacturer" $aReturn[$iFields] = .Manufacturer Case "Name" $aReturn[$iFields] = .Name Case "OtherTargetOS" $aReturn[$iFields] = .OtherTargetOS Case "PrimaryBIOS" $aReturn[$iFields] = .PrimaryBIOS Case "SerialNumber" $aReturn[$iFields] = .SerialNumber Case "SMBIOSBIOSVersion" $aReturn[$iFields] = .SMBIOSBIOSVersion Case "SMBIOSMajorVersion" $aReturn[$iFields] = .SMBIOSMajorVersion Case "SMBIOSMinorVersion" $aReturn[$iFields] = .SMBIOSMinorVersion Case "SMBIOSPresent" $aReturn[$iFields] = .SMBIOSPresent Case "SoftwareElementID" $aReturn[$iFields] = .SoftwareElementID Case "SoftwareElementState" $aReturn[$iFields] = .SoftwareElementState Case "Status" $aReturn[$iFields] = .Status Case "TargetOperatingSystem" $aReturn[$iFields] = .TargetOperatingSystem Case "Version" $aReturn[$iFields] = .Version EndSwitch Next EndWith Next Return $aReturn EndFunc ;==>_WinWMI_BIOS_GetInformation ; #FUNCTION# ====================================================================================== ; Name .............: _WinWMI_BIOS_GetLanguages() ; Description ......: Array of names of available BIOS-installable languages. ; Syntax ...........: _WinWMI_BIOS_GetLanguages(Const[ $sComputer = "127.0.0.1"]) ; Parameters .......: Const $sComputer - [optional] Target Computer (default:"127.0.0.1") ; Return values ....: Success - Returns an Array with the ListOfLanguages ; Failure - 0 Sets @error to: ; |-1 Connection failed ; |-2 WMI Class not found/no access ; |-3 No matches or more than one found ; Author ...........: Mahagon ; Link .............: http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx ; Link (German).....: http://www.scriptinternals.de/new/ger/support/Internal/WMI_Win32_BIOS.htm ; Au3.api extension.: _WinWMI_BIOS_GetLanguages( [ "Target Computer"] ) Returns an Array of names of available BIOS-installable languages. ( Requires: #include <WinWMI.au3> ) ; ================================================================================================= Func _WinWMI_BIOS_GetLanguages(Const $sComputer = "127.0.0.1") $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\CIMV2") If IsObj($oWMI) = 0 Then Return SetError(-1, @error, 0) $oList = $oWMI.ExecQuery("SELECT ListOfLanguages FROM Win32_BIOS", "WQL") If IsObj($oList) = 0 Then Return SetError(-2, @error, 0) If $oList.Count <> 1 Then Return SetError(-3, @error, 0) For $oItem In $oList Local $aReturn[UBound($oItem.ListOfLanguages)] For $iCount = 0 To UBound($oItem.ListOfLanguages) - 1 $aReturn[$iCount] = $oItem.ListOfLanguages($iCount) Next Next Return $aReturn EndFunc ;==>_WinWMI_BIOS_GetLanguages
Dauerhaft angemeldet bleiben?