Lenovo ThinkCentre M58 BIOS Windows Management Instrumentation Interface Deplo - Page 18

List all BIOS settings on the local computer, Set a single BIOS setting on the local computer

Page 18 highlights

List all BIOS settings on the local computer Use the sample scripts in the ZIP file as templates to list all BIOS settings and values on the local computer. Syntax: cscript.exe ListAll.vbs Example: cscript.exe ListAll.vbs ' ' List all BIOS settings ' On Error Resume Next Dim colItems strComputer = "LOCALHOST" ' Change as needed. Set objWMIService = GetObject("WinMgmts:" _ &"{ImpersonationLevel=Impersonate}!\\" & strComputer _ &"\root\wmi") Set colItems = objWMIService.ExecQuery("Select * from Lenovo_BiosSetting") For Each objItem in colItems If Len(objItem.CurrentSetting) > 0 Then Setting = ObjItem.CurrentSetting StrItem = Left(ObjItem.CurrentSetting,InStr( ObjItem.CurrentSetting, ",")-1) StrValue = Mid(ObjItem.CurrentSetting,InStr( ObjItem.CurrentSetting, ",")-1) WScript.Echo StrItem + " = " + StrValue End If Next Set a single BIOS setting on the local computer Use the sample scripts in the ZIP file as templates to set a single BIOS setting on the local computer. Syntax: cscript.exe SetConfig.vbs [Item] [Value] Example: cscript.exe SetConfig.vbs "Wake on LAN" Disabled ' ' Set specific BIOS Setting ' On Error Resume Next Dim colItems If WScript.Arguments.Count < > 2 Then WScript.Echo "SetConfig.vbs [setting] [value]" WScript.Quit End If strRequest = WScript.Arguments(0) + "," + WScript.Arguments(1) + "," strComputer = "LOCALHOST" ' Change as needed. Set objWMIService = GetObject("WinMgmts:"_ &"{ImpersonationLevel=Impersonate}!\\" & strComputer _ &"\root\wmi") Set colItems = objWMIService.ExecQuery("Select * from Lenovo_SetBiosSetting") For Each objItem in colItems ObjItem.SetBiosSetting strRequest, strReturn Next WScript.Echo strRequest Lenovo BIOS Windows Management Instrumentation Interface Deployment Guide for Desktop 12

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

Lenovo BIOS Windows Management Instrumentation Interface Deployment Guide for Desktop
12
List all BIOS settings on the local computer
Use the sample scripts in the ZIP file as templates to list all
BIOS settings and values on the local computer.
Syntax
:
cscript.exe
ListAll.vbs
Example
:
cscript.exe
ListAll.vbs
’ List all BIOS settings
On
Error Resume Next
Dim colItems
strComputer = "LOCALHOST"
’ Change as
needed.
Set
objWMIService
= GetObject("WinMgmts:" _
&"{ImpersonationLevel=Impersonate}!\\" & strComputer _
&"\root\wmi")
Set
colItems = objWMIService.ExecQuery("Select * from
Lenovo_BiosSetting")
For
Each objItem in colItems
If
Len(objItem.CurrentSetting) > 0 Then
Setting = ObjItem.CurrentSetting
StrItem = Left(ObjItem.CurrentSetting,InStr(
ObjItem.CurrentSetting, “,”)-1)
StrValue = Mid(ObjItem.CurrentSetting,InStr(
ObjItem.CurrentSetting, “,”)-1)
WScript.Echo StrItem + " = " + StrValue
End If
Next
Set a single BIOS setting on the local computer
Use the sample scripts in the ZIP file as templates to set a single
BIOS setting on the local computer.
Syntax
: cscript.exe SetConfig.vbs [Item]
[Value]
Example
: cscript.exe SetConfig.vbs “Wake on LAN”
Disabled
’ Set
specific BIOS Setting
On
Error Resume Next
Dim colItems
If WScript.Arguments.Count < > 2 Then
WScript.Echo "SetConfig.vbs
[setting]
[value]"
WScript.Quit
End If
strRequest = WScript.Arguments(0) + "," + WScript.Arguments(1) +
","
strComputer = "LOCALHOST"
’ Change as
needed.
Set
objWMIService
= GetObject("WinMgmts:"_
&"{ImpersonationLevel=Impersonate}!\\" & strComputer _
&"\root\wmi")
Set
colItems = objWMIService.ExecQuery("Select * from
Lenovo_SetBiosSetting")
For
Each objItem in colItems
ObjItem.SetBiosSetting strRequest, strReturn
Next
WScript.Echo strRequest