HP dx7200 HP Client Management Interface Technical White Paper - Page 23

HP Client Management Password Control

Page 23 highlights

Set colItems = objWMIService.ExecQuery(strQuery,,lFlags) For each objItem in colItems objItem.SetBiosSetting oReturn, _ strSetting, strValue, strPassword Next Dim strResult Select Case oReturn Case 0 strReturn = "Success" Case 1 strReturn = "Not Supported" Case 2 strReturn = "Unspecified Error" Case 3 strReturn = "Timeout" Case 4 strReturn = "Failed" Case 5 strReturn = "Invalid Parameter" Case 6 strReturn = "Access Denied" Case Else strReturn = "..." End Select WScript.Echo "SetBiosSetting() returned: (" & oReturn _ & ") " & strReturn Note that in the above example arguments are separated by spaces. To overcome this issue enclose individual arguments within quotation (") marks. An example command line based on the above script would look like: C:\>cscript example.vbs "Enter Ownership Tag" "Test" "1E302E020304" HP Client Management Password Control HP Client Management Interface Password Control provides two modes of operation. Stand-alone, the component can be used to convert keyboard scan codes into password text strings through a dedicated UI and cut-and-paste into the tool or code being used to modify BIOS settings. The control also provides an interactive mode of operation, in which the control can be invoked through an automation interface within a calling script or management application. The following code fragment demonstrates invoking the control from within a management script. Const wbemFlagReturnImmediately = 16 Const wbemFlagForwardOnly = 32 lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly strService = "winmgmts:{impersonationlevel=impersonate}//" strComputer = "." strNamespace = "/root/HP/InstrumentedBIOS" strQuery = "select * from HP_BIOSSettingInterface" Dim oPwdCtl, strPassword Set oPwdCtl = CreateObject("hpPwdCtl.PasswordEdit") oPwdCtl.GetPassword "Enter the Computer Setup Password:", _ strPassword Set objWMIService = GetObject(strService & _ 23

  • 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

23
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
For each objItem in colItems
objItem.SetBiosSetting oReturn, _
strSetting, strValue, strPassword
Next
Dim strResult
Select Case oReturn
Case 0 strReturn = "Success"
Case 1 strReturn = "Not Supported"
Case 2 strReturn = "Unspecified Error"
Case 3 strReturn = "Timeout"
Case 4 strReturn = "Failed"
Case 5 strReturn = "Invalid Parameter"
Case 6 strReturn = "Access Denied"
Case Else strReturn = "..."
End Select
WScript.Echo "SetBiosSetting() returned: (" & oReturn _
& ") " & strReturn
Note that in the above example arguments are separated by spaces. To overcome this issue enclose
individual arguments within quotation (“) marks. An example command line based on the above script
would look like:
C:\>cscript example.vbs "Enter Ownership Tag" "Test"
"<kbd/>1E302E020304"
HP Client Management Password Control
HP Client Management Interface Password Control provides two modes of operation. Stand-alone, the
component can be used to convert keyboard scan codes into password text strings through a
dedicated UI and cut-and-paste into the tool or code being used to modify BIOS settings. The control
also provides an interactive mode of operation, in which the control can be invoked through an
automation interface within a calling script or management application. The following code fragment
demonstrates invoking the control from within a management script.
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strService = "winmgmts:{impersonationlevel=impersonate}//"
strComputer = "."
strNamespace = "/root/HP/InstrumentedBIOS"
strQuery = "select * from HP_BIOSSettingInterface"
Dim oPwdCtl, strPassword
Set oPwdCtl = CreateObject("hpPwdCtl.PasswordEdit")
oPwdCtl.GetPassword "Enter the Computer Setup Password:", _
strPassword
Set objWMIService = GetObject(strService & _