Contact Info

Crumbtrail

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

Win32_PerfFormattedData_TermService 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_PerfFormattedData_TermService 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_PerfFormattedData_TermService_TerminalServicesSession"

foreach ($obj in $objWmi)
{
	write-host "Caption:" $obj.Caption
	write-host "Description:" $obj.Description
	write-host "Frequency_Object:" $obj.Frequency_Object
	write-host "Frequency_PerfTime:" $obj.Frequency_PerfTime
	write-host "Frequency_Sys100NS:" $obj.Frequency_Sys100NS
	write-host "HandleCount:" $obj.HandleCount
	write-host "InputAsyncFrameError:" $obj.InputAsyncFrameError
	write-host "InputAsyncOverflow:" $obj.InputAsyncOverflow
	write-host "InputAsyncOverrun:" $obj.InputAsyncOverrun
	write-host "InputAsyncParityError:" $obj.InputAsyncParityError
	write-host "InputBytes:" $obj.InputBytes
	write-host "InputCompressedBytes:" $obj.InputCompressedBytes
	write-host "InputCompressFlushes:" $obj.InputCompressFlushes
	write-host "InputCompressionRatio:" $obj.InputCompressionRatio
	write-host "InputErrors:" $obj.InputErrors
	write-host "InputFrames:" $obj.InputFrames
	write-host "InputTimeouts:" $obj.InputTimeouts
	write-host "InputTransportErrors:" $obj.InputTransportErrors
	write-host "InputWaitForOutBuf:" $obj.InputWaitForOutBuf
	write-host "InputWdBytes:" $obj.InputWdBytes
	write-host "InputWdFrames:" $obj.InputWdFrames
	write-host "Name:" $obj.Name
	write-host "OutputAsyncFrameError:" $obj.OutputAsyncFrameError
	write-host "OutputAsyncOverflow:" $obj.OutputAsyncOverflow
	write-host "OutputAsyncOverrun:" $obj.OutputAsyncOverrun
	write-host "OutputAsyncParityError:" $obj.OutputAsyncParityError
	write-host "OutputBytes:" $obj.OutputBytes
	write-host "OutputCompressedBytes:" $obj.OutputCompressedBytes
	write-host "OutputCompressFlushes:" $obj.OutputCompressFlushes
	write-host "OutputCompressionRatio:" $obj.OutputCompressionRatio
	write-host "OutputErrors:" $obj.OutputErrors
	write-host "OutputFrames:" $obj.OutputFrames
	write-host "OutputTimeouts:" $obj.OutputTimeouts
	write-host "OutputTransportErrors:" $obj.OutputTransportErrors
	write-host "OutputWaitForOutBuf:" $obj.OutputWaitForOutBuf
	write-host "OutputWdBytes:" $obj.OutputWdBytes
	write-host "OutputWdFrames:" $obj.OutputWdFrames
	write-host "PageFaultsPersec:" $obj.PageFaultsPersec
	write-host "PageFileBytes:" $obj.PageFileBytes
	write-host "PageFileBytesPeak:" $obj.PageFileBytesPeak
	write-host "PercentPrivilegedTime:" $obj.PercentPrivilegedTime
	write-host "PercentProcessorTime:" $obj.PercentProcessorTime
	write-host "PercentUserTime:" $obj.PercentUserTime
	write-host "PoolNonpagedBytes:" $obj.PoolNonpagedBytes
	write-host "PoolPagedBytes:" $obj.PoolPagedBytes
	write-host "PrivateBytes:" $obj.PrivateBytes
	write-host "ProtocolBitmapCacheHitRatio:" $obj.ProtocolBitmapCacheHitRatio
	write-host "ProtocolBitmapCacheHits:" $obj.ProtocolBitmapCacheHits
	write-host "ProtocolBitmapCacheReads:" $obj.ProtocolBitmapCacheReads
	write-host "ProtocolBrushCacheHitRatio:" $obj.ProtocolBrushCacheHitRatio
	write-host "ProtocolBrushCacheHits:" $obj.ProtocolBrushCacheHits
	write-host "ProtocolBrushCacheReads:" $obj.ProtocolBrushCacheReads
	write-host "ProtocolGlyphCacheHitRatio:" $obj.ProtocolGlyphCacheHitRatio
	write-host "ProtocolGlyphCacheHits:" $obj.ProtocolGlyphCacheHits
	write-host "ProtocolGlyphCacheReads:" $obj.ProtocolGlyphCacheReads
	write-host "ProtocolSaveScreenBitmapCacheHitRatio:" $obj.ProtocolSaveScreenBitmapCacheHitRatio
	write-host "ProtocolSaveScreenBitmapCacheHits:" $obj.ProtocolSaveScreenBitmapCacheHits
	write-host "ProtocolSaveScreenBitmapCacheReads:" $obj.ProtocolSaveScreenBitmapCacheReads
	write-host "ThreadCount:" $obj.ThreadCount
	write-host "Timestamp_Object:" $obj.Timestamp_Object
	write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime
	write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS
	write-host "TotalAsyncFrameError:" $obj.TotalAsyncFrameError
	write-host "TotalAsyncOverflow:" $obj.TotalAsyncOverflow
	write-host "TotalAsyncOverrun:" $obj.TotalAsyncOverrun
	write-host "TotalAsyncParityError:" $obj.TotalAsyncParityError
	write-host "TotalBytes:" $obj.TotalBytes
	write-host "TotalCompressedBytes:" $obj.TotalCompressedBytes
	write-host "TotalCompressFlushes:" $obj.TotalCompressFlushes
	write-host "TotalCompressionRatio:" $obj.TotalCompressionRatio
	write-host "TotalErrors:" $obj.TotalErrors
	write-host "TotalFrames:" $obj.TotalFrames
	write-host "TotalProtocolCacheHitRatio:" $obj.TotalProtocolCacheHitRatio
	write-host "TotalProtocolCacheHits:" $obj.TotalProtocolCacheHits
	write-host "TotalProtocolCacheReads:" $obj.TotalProtocolCacheReads
	write-host "TotalTimeouts:" $obj.TotalTimeouts
	write-host "TotalTransportErrors:" $obj.TotalTransportErrors
	write-host "TotalWaitForOutBuf:" $obj.TotalWaitForOutBuf
	write-host "TotalWdBytes:" $obj.TotalWdBytes
	write-host "TotalWdFrames:" $obj.TotalWdFrames
	write-host "VirtualBytes:" $obj.VirtualBytes
	write-host "VirtualBytesPeak:" $obj.VirtualBytesPeak
	write-host "WorkingSet:" $obj.WorkingSet
	write-host "WorkingSetPeak:" $obj.WorkingSetPeak
	write-host
	write-host "########"
	write-host
}