Lenovo ThinkCentre M92 BIOS Windows Management Instrumentation Interface Deplo - Page 32

Set a Administrator password on the local computer, when a Administrator password exists

Page 32 highlights

End If strRequest = WScript.Arguments(0) + "," + WScript.Arguments(1) + ";" strComputer = WScript.Arguments(3) Set objWMIService = GetObject("WinMgmts:" _ &"{ImpersonationLevel=Impersonate," _ &"authenticationLevel=pktPrivacy}!\\" _ & strComputer & "\root\wmi") Set colItems = objWMIService.ExecQuery("Select * from Lenovo_SetBiosSetting") For Each objItem in colItems ObjItem.SetBiosSetting strRequest, strReturn Next WScript.Echo strRequest WScript.Echo " SetBiosSetting: " + 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 Wscript.Arguments(2)+";", strReturn Next WScript.Echo strRequest WScript.Echo " SaveBiosSettings: " + strReturn Set a Administrator password on the local computer when a Administrator password exists Use the sample scripts in the ZIP file as templates to set a single BIOS setting on a remote computer. Note: You cannot set a password if one does not already exist. Syntax: cscript.exe SetAdminPassword.vbs [old password] [new password] [encoding] Example: cscript.exe SetAdminPassword.vbs oldpass newpass "ascii,us" ' ' Update Administrator password ' On Error Resume Next Dim colItems If WScript.Arguments.Count < > 3 Then WScript.Echo "SetAdminPassword.vbs [oldpassword] [newpassword] [encoding]" WScript.Quit End If strRequest="pap,"+WScript.Arguments(0)+","+ WScript.Arguments(1) + ","Wscript.Arguments(2)+";" strCompter = "LOCALHOST" 'change as needed Set objWMIService = GetObject("WinMgmts:" _ Lenovo BIOS Windows Management Instrumentation Interface Deployment Guide for Desktop 24

  • 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

Lenovo BIOS Windows Management Instrumentation Interface Deployment Guide for Desktop
24
End If
strRequest = WScript.Arguments(0) + "," + WScript.Arguments(1) +
";"
strComputer = WScript.Arguments(3)
Set
objWMIService
= GetObject("WinMgmts:" _
&"{ImpersonationLevel=Impersonate," _
&"authenticationLevel=pktPrivacy}!\\" _
&
strComputer &
"\root\wmi")
Set
colItems
=
objWMIService.ExecQuery("Select
*
from
Lenovo_SetBiosSetting")
For
Each objItem in colItems
ObjItem.SetBiosSetting strRequest, strReturn
Next
WScript.Echo strRequest
WScript.Echo "
SetBiosSetting: "
+ 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 Wscript.Arguments(2)+";", strReturn
Next
WScript.Echo strRequest
WScript.Echo "
SaveBiosSettings: "
+ strReturn
Set a Administrator password on the local computer
when a Administrator password exists
Use the sample scripts in the ZIP file as templates to set a single
BIOS setting on a remote computer.
Note
: You cannot set a password if one does not already exist.
Syntax
:
cscript.exe
SetAdminPassword.vbs [old password] [new
password] [encoding]
Example
:
cscript.exe
SetAdminPassword.vbs
oldpass
newpass
ascii,us
Update Administrator password
On
Error Resume Next
Dim colItems
If WScript.Arguments.Count < > 3 Then
WScript.Echo "SetAdminPassword.vbs [oldpassword] [newpassword]
[encoding]"
WScript.Quit
End If
strRequest
=“
pap,
+WScript.Arguments(0)+","+ WScript.Arguments(1)
+ ","Wscript.Arguments(2)+
;
strCompter =
LOCALHOST
change as needed
Set
objWMIService
= GetObject("WinMgmts:" _