@Copyright Lenovo 2010 15
Appendix A. Sample Visual Basic scripts for
configuring BIOS settings
The Visual Basic command line scripts in the ZIP file are examples
thatyoumayfindhelpfulwhenconfiguringBIOSsettings.
The scripts in the ZIP file can be used as‐is on Windows XP,
Windows Vista
, or Windows 7 tomodify BIOS settings on your
Lenovo computer. . The script canbe executedon a command prompt
using the cscript.exeutility.On WindowsVista and Windows 7, you
mustrunthe scripts from anadministrator command prompt.
Note: The scripts in this appendix are for reference only. To copy
andpastescripts,usethe scriptsintheZIPfile.
Restore default settings
UsetheexamplescriptsintheZIPfileastemplatestorestoredefault
settingsonthe localcomputer.
Syntax:
cscript.exe LoadDefaults.vbs
Example:
cscript.exe LoadDefaults.vbs
’
’ Load default 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_LoadDefaultSettings")
strReturn = "error"
For Each objItem in colItems
ObjItem.LoadDefaultSettings ",", strReturn
Next
WScript.Echo " LoadDefaultSettings: " + strReturn
If strReturn < > "Success" Then
WScript.Quit
End If
Set colItems = objWMIService.ExecQuery("Select * from
Lenovo_SaveBiosSettings")
strReturn = "error"
For Each objItem in colItems
ObjItem.SaveBiosSettings ",", strReturn
Next
WScript.Echo " SaveBiosSettings: " + strReturn