au3 如何读取品牌机器bios信息
求一个au3 程序思路需求:
1、读取品牌机器bios机器字段信息,例如(读取HP 台式机的bios中的 product name的信息)
2、根据读取的信息,判断运行某一个命令
3、单位有很多品牌pc,想要用u盘pe,让员工自行安装,U盘放置很多ghost文件。
想做一个脚本,自动读取pc bios的字段,根据读取的信息,自动判断,自动搜索相应的ghost,如搜索不到,弹出对话框,有ghost镜像列表,手动自行ghost程序
这个是ghost配置文件
ghost32path = \pesoft\ghost\ghost32.exe
;没有参数调用接口
name = HP-3085-WIN7
ghofile = \hp\3085\3085.GHO
;参数 /setup1或-setup1调用接口
name = HP-3348-WIN7
ghofile = \hp\3348\3348.GHO
;参数 /setup2或-setup2调用接口
name = HP-3385-WIN7
ghofile = \hp\3385\3385.GHO
;以此类推......
__________________________________________________________________________________
配置说明:
配置文件与主文件仅扩展名不同。修改任何一个文件名请同时修改另一个文件名
本程序可带参数运行,以调用不同的GHO镜像方便多合一盘,每个参数对应INI中同名的字段。
例如:
运行GHOSTXP -SETUP1或GHOSTXP /SETUP1 则调用GHOSTXP.INI中的中的各项
运行GHOSTXP -SETUP2或GHOSTXP /SETUP2 则调用GHOSTXP.INI中的中的各项
运行GHOSTXP -SETUP3或GHOSTXP /SETUP3 则调用GHOSTXP.INI中的中的各项
......以此类推。
不带参数则运行中指定各项
自定义的参数对应在INI中的字段名称必须用“[]”括起来,如:
ghost32path 指定GHOST32.EXE的路径,注意参照写法(不用写盘符)
name 指定要恢复的GHO镜像的系统名称,如:Windows XP SP2 纯净版
ghofile 指定恢复的GHO镜像文件名,注意参照写法(带路径,不用写盘符) __wmi_Win32_BIOS()
Func __wmi_Win32_BIOS()
Local $wbemFlagReturnImmediately = 0x10
Local $wbemFlagForwardOnly = 0x20
Local $colItems = ""
Local $strComputer = "localhost"
Local $Output=""
$Output &= "Computer: " & $strComputer& @CRLF
$Output &= "==========================================" & @CRLF
Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
Local $strBiosCharacteristics = $objItem.BiosCharacteristics(0)
$Output &= "BiosCharacteristics: " & $strBiosCharacteristics & @CRLF
Local $strBIOSVersion = $objItem.BIOSVersion(0)
$Output &= "BIOSVersion: " & $strBIOSVersion & @CRLF
$Output &= "BuildNumber: " & $objItem.BuildNumber & @CRLF
$Output &= "Caption: " & $objItem.Caption & @CRLF
$Output &= "CodeSet: " & $objItem.CodeSet & @CRLF
$Output &= "CurrentLanguage: " & $objItem.CurrentLanguage & @CRLF
$Output &= "Description: " & $objItem.Description & @CRLF
$Output &= "IdentificationCode: " & $objItem.IdentificationCode & @CRLF
$Output &= "InstallableLanguages: " & $objItem.InstallableLanguages & @CRLF
$Output &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
$Output &= "LanguageEdition: " & $objItem.LanguageEdition & @CRLF
Local $strListOfLanguages = $objItem.ListOfLanguages(0)
$Output &= "ListOfLanguages: " & $strListOfLanguages & @CRLF
$Output &= "Manufacturer: " & $objItem.Manufacturer & @CRLF
$Output &= "Name: " & $objItem.Name & @CRLF
$Output &= "OtherTargetOS: " & $objItem.OtherTargetOS & @CRLF
$Output &= "PrimaryBIOS: " & $objItem.PrimaryBIOS & @CRLF
$Output &= "ReleaseDate: " & WMIDateStringToDate($objItem.ReleaseDate) & @CRLF
$Output &= "SerialNumber: " & $objItem.SerialNumber & @CRLF
$Output &= "SMBIOSBIOSVersion: " & $objItem.SMBIOSBIOSVersion & @CRLF
$Output &= "SMBIOSMajorVersion: " & $objItem.SMBIOSMajorVersion & @CRLF
$Output &= "SMBIOSMinorVersion: " & $objItem.SMBIOSMinorVersion & @CRLF
$Output &= "SMBIOSPresent: " & $objItem.SMBIOSPresent & @CRLF
$Output &= "SoftwareElementID: " & $objItem.SoftwareElementID & @CRLF
$Output &= "SoftwareElementState: " & $objItem.SoftwareElementState & @CRLF
$Output &= "Status: " & $objItem.Status & @CRLF
$Output &= "TargetOperatingSystem: " & $objItem.TargetOperatingSystem & @CRLF
$Output &= "Version: " & $objItem.Version & @CRLF
if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
$Output=""
Next
Else
Msgbox(0,"WMI 输出","没有在类 " & "Win32_BIOS" & "中找到WMI对象" )
Endif
EndFunc
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 你不如收集网卡的MAC地址好了。在PE下是能用的。dos下面可以收集cpu特征码。虽然工作量大点儿,但简单。
如果你坚持需要Bois。可以跟我联系。我有代码。回头帮你找找。 $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colBios = $objWMIService.ExecQuery("Select * from Win32_BIOS")
$Bios = ""
For $object In $colBios ;Bios 1
$Bios &= StringMid($object.Caption, 1)
Next
MsgBox(0,'', $Bios) 运行没什么放映啊!!!
页:
[1]