HP Integrity rx2800 HP Insight Management WBEM Providers on Integrity Servers - Page 24
Other examples, Scripting references
View all HP Integrity rx2800 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 24 highlights
Example 5-7 Clearing the record log strComputer = "." strNamespace = "\root\hpq" Set objWMIService = GetObject("winmgmts:\\" & strComputer & strNamespace) Set colCommonRecordLog = objWMIService.ExecQuery("Select * from HPQ_CommonRecordLog") Wscript.Echo "Clearing the record log..." For Each objCommonRecordLog in colCommonRecordLog objCommonRecordLog.ClearLog() Next Example 5-8 Receiving an alert indication strComputer = "." strNamespace = "\root\hpq" Set objWMIService = GetObject("winmgmts:\\" & strComputer & strNamespace) Set objIndication = objWMIService.ExecNotificationQuery("SELECT * FROM HP_AlertIndication") Wscript.Echo "Waiting for alert indication..." Set objReceivedIndication = objIndication.NextEvent WScript.Echo "Provider Name = " & objReceivedIndication.ProviderName WScript.Echo "Event ID = " & objReceivedIndication.EventID WScript.Echo "Severity = " & objReceivedIndication.PerceivedSeverity WScript.Echo "Description = " & objReceivedIndication.Description Other examples You can also write scripts to obtain data from the Insight Providers using Microsoft Windows Management Instrumentation Command-line (WMIC) and Microsoft Windows PowerShell. The following command is used to display computer system status information using WMIC in noninteractive mode: wmic /namespace:\\root\hpq path hp_wincomputersystem get caption,OperationalStatus,StatusDescriptions The following Windows PowerShell script code can be used to list fans in the system: $strComputer = "." $strNamespace = "root\hpq" $colFan = Get-WMIObject -class "hp_winfan" -namespace $strNamespace computername $strComputer foreach ($objFan in $colFan) { write-host $objFan.Name, $objFan.Description } Scripting references For more information regarding WMI scripting, see the following WMI references on the MSDN website: • Scripting Access to WMI (http://msdn2.microsoft.com/en-us/library/aa393256.aspx) • Visual Basic Scripting Edition (http://msdn2.microsoft.com/en-us/library/t0aew7h6.aspx) • WMI Command-line (http://msdn2.microsoft.com/en-us/library/aa394531.aspx) 24 Scripting examples