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

WScript.Echo Err.Number, Err.Description, Err.Source

Page 20 highlights

Case 5 strReturn = "Invalid Parameter" Case 6 strReturn = "Access Denied" Case Else strReturn = "..." End Select WScript.Echo "SetSystemDefaults() returned: (" & oReturn _ & ") " & strReturn Monitoring Events Monitoring system health events is one of the more advanced aspects of the HP Client Management Interface. The approach to monitoring event presented here is designed to illustrate the capabilities of the interface, however, in an enterprise environment a more robust event consumer model would be recommended to monitor events without impacting system resources. HP CMI supports semi-synchronous and asynchronous event notifications. For more information on WMI event consumers, consult the Microsoft WMI SDK. on error resume next strService = "winmgmts:\\" strComputer = "." strNamespace = "\root\WMI" strQuery = "select * from HPBIOS_BIOSEvent" set objWMIService = GetObject( strService & strComputer _ & strNamespace ) set events = objWMIService.ExecNotificationQuery( strQuery ) if err 0 then WScript.Echo Err.Description, Err.Number, Err.Source end if WScript.Echo "Waiting for CMI Events..." WScript.Echo "Press Ctrl-C to exit." WScript.Echo "" Dim strCategory Dim strSeverity Dim strStatus Counter = 1 do ' Note this next call will wait indefinitely. set CMIEvent = events.nextevent if err 0 then WScript.Echo Err.Number, Err.Description, Err.Source Exit Do else Select Case CMIEvent.category Case 0 strCategory = "Unknown" Case 1 strCategory = "Configuration Change" Case 2 strCategory = "Button Pressed" Case 3 strCategory = "Sensor" Case 4 strCategory = "BIOS Settings" Case Else strCategory = "..." 20

  • 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

20
Case 5 strReturn = "Invalid Parameter"
Case 6 strReturn = "Access Denied"
Case Else strReturn = "..."
End Select
WScript.Echo "SetSystemDefaults() returned: (" & oReturn _
& ") " & strReturn
Monitoring Events
Monitoring system health events is one of the more advanced aspects of the HP Client Management
Interface. The approach to monitoring event presented here is designed to illustrate the capabilities of
the interface, however, in an enterprise environment a more robust event consumer model would be
recommended to monitor events without impacting system resources. HP CMI supports
semi-synchronous and asynchronous event notifications. For more information on WMI event
consumers, consult the Microsoft WMI SDK.
on error resume next
strService = "winmgmts:\\"
strComputer = "."
strNamespace = "\root\WMI"
strQuery = "select * from HPBIOS_BIOSEvent"
set objWMIService = GetObject( strService & strComputer _
& strNamespace )
set events = objWMIService.ExecNotificationQuery( strQuery )
if err <> 0 then
WScript.Echo Err.Description, Err.Number, Err.Source
end if
WScript.Echo "Waiting for CMI Events..."
WScript.Echo "Press Ctrl-C to exit."
WScript.Echo ""
Dim strCategory
Dim strSeverity
Dim strStatus
Counter = 1
do
' Note this next call will wait indefinitely.
set CMIEvent = events.nextevent
if err <> 0 then
WScript.Echo Err.Number, Err.Description, Err.Source
Exit Do
else
Select Case CMIEvent.category
Case 0 strCategory = "Unknown"
Case 1 strCategory = "Configuration Change"
Case 2 strCategory = "Button Pressed"
Case 3 strCategory = "Sensor"
Case 4 strCategory = "BIOS Settings"
Case Else strCategory = "..."