Contact Info

Crumbtrail

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

Win32_PerfRawData_ReportServer 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 Win32_PerfRawData_ReportServer WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

$strComputer = "."

$objWMi = get-wmiobject -computername localhost -Namespace root\CIMV2 -Query "Select * from Win32_PerfRawData_ReportServer_ReportServerService"

foreach ($obj in $objWmi)
{
	write-host "ActiveConnections:" $obj.ActiveConnections
	write-host "BytesReceivedPersec:" $obj.BytesReceivedPersec
	write-host "BytesReceivedTotal:" $obj.BytesReceivedTotal
	write-host "BytesSentPersec:" $obj.BytesSentPersec
	write-host "BytesSentTotal:" $obj.BytesSentTotal
	write-host "Caption:" $obj.Caption
	write-host "Description:" $obj.Description
	write-host "ErrorsPersec:" $obj.ErrorsPersec
	write-host "ErrorsTotal:" $obj.ErrorsTotal
	write-host "Frequency_Object:" $obj.Frequency_Object
	write-host "Frequency_PerfTime:" $obj.Frequency_PerfTime
	write-host "Frequency_Sys100NS:" $obj.Frequency_Sys100NS
	write-host "LogonAttemptsPersec:" $obj.LogonAttemptsPersec
	write-host "LogonAttemptsTotal:" $obj.LogonAttemptsTotal
	write-host "LogonSuccessesPersec:" $obj.LogonSuccessesPersec
	write-host "LogonSuccessesTotal:" $obj.LogonSuccessesTotal
	write-host "MemoryPressureState:" $obj.MemoryPressureState
	write-host "MemoryShrinkAmount:" $obj.MemoryShrinkAmount
	write-host "MemoryShrinkNotificationsPersec:" $obj.MemoryShrinkNotificationsPersec
	write-host "Name:" $obj.Name
	write-host "RequestsDisconnected:" $obj.RequestsDisconnected
	write-host "RequestsExecuting:" $obj.RequestsExecuting
	write-host "RequestsNotAuthorized:" $obj.RequestsNotAuthorized
	write-host "RequestsPersec:" $obj.RequestsPersec
	write-host "RequestsRejected:" $obj.RequestsRejected
	write-host "RequestsTotal:" $obj.RequestsTotal
	write-host "TasksQueued:" $obj.TasksQueued
	write-host "Timestamp_Object:" $obj.Timestamp_Object
	write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime
	write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS
	write-host
	write-host "########"
	write-host
}