Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » powershell sample

CIM powershell sample code

The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The CIM WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

$strComputer = "."

$objWMi = get-wmiobject -computername localhost -Query "Select * from CIM_Action"

foreach ($obj in $objWmi)
{
	write-host "ActionID:" $obj.ActionID
	write-host "AppID:" $obj.AppID
	write-host "Argument:" $obj.Argument
	write-host "Caption:" $obj.Caption
	write-host "CLSID:" $obj.CLSID
	write-host "Context:" $obj.Context
	write-host "DefInprocHandler:" $obj.DefInprocHandler
	write-host "Description:" $obj.Description
	write-host "Direction:" $obj.Direction
	write-host "FileTypeMask:" $obj.FileTypeMask
	write-host "Insertable:" $obj.Insertable
	write-host "Name:" $obj.Name
	write-host "ProgID:" $obj.ProgID
	write-host "RemoteName:" $obj.RemoteName
	write-host "SoftwareElementID:" $obj.SoftwareElementID
	write-host "SoftwareElementState:" $obj.SoftwareElementState
	write-host "TargetOperatingSystem:" $obj.TargetOperatingSystem
	write-host "Version:" $obj.Version
	write-host "VIProgID:" $obj.VIProgID
	write-host
	write-host "########"
	write-host
}