Previous Topic

Next Topic

WMIC example

You can also write scripts to obtain data from the Insight Providers using 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

}