我一直在尝试编写一个vbs脚本,我可以将其用作SCCM 2012中的部署,这将改变bios功能" LAN / WLAN Auto Switching"用于笔记本电脑。 我发现了这篇文章http://www.kozeniauskas.com/itblog/2008/01/18/remotely-change-bios-settings/。但是 objItem.SetBiosSetting oReturn," LAN / WLAN Switching"," Enable","< kbd />" 对于较新的笔记本电脑似乎无法正常工作。它适用于较旧的笔记本电脑。
同一篇文章有一个用于转储所有属性名称的脚本。似乎在9480笔记本电脑上,它被称为“LAN / WLAN交换机”,但在1040台笔记本电脑上,该功能被称为“LAN / WLAN自动切换"”。我已尝试将该名称插入同一行,但它不会启用LAN / WLAN切换。
惠普发布的白皮书没有可用于SetBiosSetting的特定属性。 http://h20331.www2.hp.com/Hpsub/downloads/cmi_whitepaper.pdf确实告诉我,oReturn值为4只意味着失败。
目前我的代码看起来像......
检测BIOS设置(适用于两种型号):
Dim objFileSystem, strReturn
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strService = "winmgmts:{impersonationlevel=impersonate}//"
strComputer = "."
strNamespace = "/root/HP/InstrumentedBIOS"
strQuery = "select * from HP_BIOSSetting where name like '%Switching%' AND name like '%LAN%'"
strReturn = "Fail"
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objWMIService = GetObject(strService & strComputer & strNamespace)
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
For Each objItem In colItems
If objItem.Value = " Disable, *Enable" then strReturn = "Success"
Next
Set objFileSystem = Nothing
wscript.echo strReturn
设置bios设置脚本(仅适用于9480):
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strService = "winmgmts:{impersonationlevel=impersonate}//"
strComputer = "."
strNamespace = "/root/HP/InstrumentedBIOS"
strQuery = "select * from HP_BIOSSettingInterface"
Set objWMIService = GetObject(strService & strComputer & strNamespace)
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
For each objItem in colItems
objItem.SetBiosSetting oReturn, "LAN/WLAN Switching", "Enable", "<kbd/>"
Next
我想避免使用HP Bios配置实用程序。
答案 0 :(得分:0)
原来他们将属性从“启用”更新为“已启用”。 我的代码现在看起来像......
获取WLAN_LAN:
Dim objFileSystem, strReturn
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strService = "winmgmts:{impersonationlevel=impersonate}//"
strComputer = "."
strNamespace = "/root/HP/InstrumentedBIOS"
strQuery = "select * from HP_BIOSSetting where name like '%Switching%' AND name like '%LAN%'"
strReturn = "Fail"
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objWMIService = GetObject(strService & strComputer & strNamespace)
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
For Each objItem In colItems
If objItem.Value = " Disable, *Enable" OR objItem.Value = "Disabled,*Enabled" then strReturn = "Success"
Next
Set objFileSystem = Nothing
wscript.echo strReturn
设置WLAN_LAN:
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strService = "winmgmts:{impersonationlevel=impersonate}//"
strComputer = "."
strNamespace = "/root/HP/InstrumentedBIOS"
strQuery = "select * from HP_BIOSSettingInterface"
Set objWMIService = GetObject(strService & strComputer & strNamespace)
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
For each objItem in colItems
objItem.SetBiosSetting oReturn, "LAN/WLAN Switching", "Enable", "<kbd/>"
if oReturn <> 0 then objItem.SetBiosSetting oReturn, "LAN / WLAN Auto Switching", "Enabled", "<kbd/>"
Next
我可能会清理这些并使它们变得均匀,但是你应该在两种情况下都能正常工作。我可能还会使用inStr来检测它是否已启用。