Lenovo ThinkPad T420 (English) BIOS Setup using Windows Management Instrumenta - Page 25

Appendix, Sample, Visual, Basic, scripts, conFguring, settings

Page 25 highlights

Appendix A. Sample Visual Basic scripts for configuring BIOS settings The Visual Basic command line scripts in the ZIP file are examples that you may find helpful when configuring BIOS settings. The scripts in the ZIP file can be used as-is on Windows XP, Windows Vista, or Windows 7 to modify BIOS settings on your Lenovo computer. The scripts can be executed on a command prompt using the cscript.exe utility. On Windows Vista and Windows 7, you must run the scripts from an administrator command prompt. Note: The scripts in this appendix are for reference only. To copy and paste scripts, use the scripts in the ZIP file. Restore default settings Use the example scripts in the ZIP file as templates to restore default settings on the local computer. 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 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 © Copyright Lenovo 2008, 2012 17

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

Appendix
A.
Sample
Visual
Basic
scripts
for
conFguring
BIOS
settings
The
Visual
Basic
command
line
scripts
in
the
ZIP
±le
are
examples
that
you
may
±nd
helpful
when
con±guring
BIOS
settings.
The
scripts
in
the
ZIP
±le
can
be
used
as-is
on
Windows
XP,
Windows
Vista,
or
Windows
7
to
modify
BIOS
settings
on
your
Lenovo
computer.
The
scripts
can
be
executed
on
a
command
prompt
using
the
cscript.exe
utility.
On
Windows
Vista
and
Windows
7,
you
must
run
the
scripts
from
an
administrator
command
prompt.
Note:
The
scripts
in
this
appendix
are
for
reference
only.
To
copy
and
paste
scripts,
use
the
scripts
in
the
ZIP
±le.
Restore
default
settings
Use
the
example
scripts
in
the
ZIP
±le
as
templates
to
restore
default
settings
on
the
local
computer.
Syntax
:
FVFULSW³H[H
/RDG'HIDXOWV³YEV
Example
:
FVFULSW³H[H
/RDG'HIDXOWV³YEV
´
´
/RDG
GHIDXOW
%,26
VHWWLQJV
´
2Q
(UURU
5HVXPH
1H[W
'LP
FRO,WHPV
VWU&RPSXWHU
° µ/2&$/+267µ
´
&KDQJH
DV
QHHGHG³
6HW
REM:0,6HUYLFH
°
*HW2EMHFW¶µ:LQ0JPWV²µ
B
·µ^,PSHUVRQDWLRQ/HYHO°,PSHUVRQDWH`¸??µ ·
VWU&RPSXWHU · µ?URRW?ZPLµ¹
6HW
FRO,WHPV
°
REM:0,6HUYLFH³([HF4XHU\¶µ6HOHFW
º
IURP
/HQRYRB/RDG'HIDXOW6HWWLQJVµ¹
VWU5HWXUQ
° µHUURUµ
)RU
(DFK
REM,WHP
LQ
FRO,WHPV
2EM,WHP³/RDG'HIDXOW6HWWLQJV µ»µ¼
VWU5HWXUQ
1H[W
:6FULSW³(FKR µ
/RDG'HIDXOW6HWWLQJV² µ
½
VWU5HWXUQ
,I
VWU5HWXUQ
¾! µ6XFFHVVµ
7KHQ
:6FULSW³4XLW
(QG
,I
6HW
FRO,WHPV
°
REM:0,6HUYLFH³([HF4XHU\¶µ6HOHFW
º
IURP
/HQRYRB6DYH%LRV6HWWLQJVµ¹
VWU5HWXUQ
° µHUURUµ
)RU
(DFK
REM,WHP
LQ
FRO,WHPV
2EM,WHP³6DYH%LRV6HWWLQJV µ»µ¼
VWU5HWXUQ
1H[W
:6FULSW³(FKR µ
6DYH%LRV6HWWLQJV² µ
½
VWU5HWXUQ
List
all
BIOS
settings
on
the
local
computer
Use
the
sample
scripts
in
the
ZIP
±le
as
templates
to
list
all
BIOS
settings
and
values
on
the
local
computer.
Syntax
:
FVFULSW³H[H
/LVW$OO³YEV
Example
:
FVFULSW³H[H
/LVW$OO³YEV
©
Copyright
Lenovo
2008,
2012
17