Contact Info

Crumbtrail

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

Win32_PerfRawData_W3SVC 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_W3SVC 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_W3SVC_WebService"

foreach ($obj in $objWmi)
{
	write-host "AnonymousUsersPersec:" $obj.AnonymousUsersPersec
	write-host "BytesReceivedPersec:" $obj.BytesReceivedPersec
	write-host "BytesSentPersec:" $obj.BytesSentPersec
	write-host "BytesTotalPersec:" $obj.BytesTotalPersec
	write-host "Caption:" $obj.Caption
	write-host "CGIRequestsPersec:" $obj.CGIRequestsPersec
	write-host "ConnectionAttemptsPersec:" $obj.ConnectionAttemptsPersec
	write-host "CopyRequestsPersec:" $obj.CopyRequestsPersec
	write-host "CurrentAnonymousUsers:" $obj.CurrentAnonymousUsers
	write-host "CurrentBlockedAsyncIORequests:" $obj.CurrentBlockedAsyncIORequests
	write-host "Currentblockedbandwidthbytes:" $obj.Currentblockedbandwidthbytes
	write-host "CurrentCALcountforauthenticatedusers:" $obj.CurrentCALcountforauthenticatedusers
	write-host "CurrentCALcountforSSLconnections:" $obj.CurrentCALcountforSSLconnections
	write-host "CurrentCGIRequests:" $obj.CurrentCGIRequests
	write-host "CurrentConnections:" $obj.CurrentConnections
	write-host "CurrentISAPIExtensionRequests:" $obj.CurrentISAPIExtensionRequests
	write-host "CurrentNonAnonymousUsers:" $obj.CurrentNonAnonymousUsers
	write-host "DeleteRequestsPersec:" $obj.DeleteRequestsPersec
	write-host "Description:" $obj.Description
	write-host "FilesPersec:" $obj.FilesPersec
	write-host "FilesReceivedPersec:" $obj.FilesReceivedPersec
	write-host "FilesSentPersec:" $obj.FilesSentPersec
	write-host "Frequency_Object:" $obj.Frequency_Object
	write-host "Frequency_PerfTime:" $obj.Frequency_PerfTime
	write-host "Frequency_Sys100NS:" $obj.Frequency_Sys100NS
	write-host "GetRequestsPersec:" $obj.GetRequestsPersec
	write-host "HeadRequestsPersec:" $obj.HeadRequestsPersec
	write-host "ISAPIExtensionRequestsPersec:" $obj.ISAPIExtensionRequestsPersec
	write-host "LockedErrorsPersec:" $obj.LockedErrorsPersec
	write-host "LockRequestsPersec:" $obj.LockRequestsPersec
	write-host "LogonAttemptsPersec:" $obj.LogonAttemptsPersec
	write-host "MaximumAnonymousUsers:" $obj.MaximumAnonymousUsers
	write-host "MaximumCALcountforauthenticatedusers:" $obj.MaximumCALcountforauthenticatedusers
	write-host "MaximumCALcountforSSLconnections:" $obj.MaximumCALcountforSSLconnections
	write-host "MaximumCGIRequests:" $obj.MaximumCGIRequests
	write-host "MaximumConnections:" $obj.MaximumConnections
	write-host "MaximumISAPIExtensionRequests:" $obj.MaximumISAPIExtensionRequests
	write-host "MaximumNonAnonymousUsers:" $obj.MaximumNonAnonymousUsers
	write-host "MeasuredAsyncIOBandwidthUsage:" $obj.MeasuredAsyncIOBandwidthUsage
	write-host "MkcolRequestsPersec:" $obj.MkcolRequestsPersec
	write-host "MoveRequestsPersec:" $obj.MoveRequestsPersec
	write-host "Name:" $obj.Name
	write-host "NonAnonymousUsersPersec:" $obj.NonAnonymousUsersPersec
	write-host "NotFoundErrorsPersec:" $obj.NotFoundErrorsPersec
	write-host "OptionsRequestsPersec:" $obj.OptionsRequestsPersec
	write-host "OtherRequestMethodsPersec:" $obj.OtherRequestMethodsPersec
	write-host "PostRequestsPersec:" $obj.PostRequestsPersec
	write-host "PropfindRequestsPersec:" $obj.PropfindRequestsPersec
	write-host "ProppatchRequestsPersec:" $obj.ProppatchRequestsPersec
	write-host "PutRequestsPersec:" $obj.PutRequestsPersec
	write-host "SearchRequestsPersec:" $obj.SearchRequestsPersec
	write-host "ServiceUptime:" $obj.ServiceUptime
	write-host "Timestamp_Object:" $obj.Timestamp_Object
	write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime
	write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS
	write-host "TotalAllowedAsyncIORequests:" $obj.TotalAllowedAsyncIORequests
	write-host "TotalAnonymousUsers:" $obj.TotalAnonymousUsers
	write-host "TotalBlockedAsyncIORequests:" $obj.TotalBlockedAsyncIORequests
	write-host "Totalblockedbandwidthbytes:" $obj.Totalblockedbandwidthbytes
	write-host "TotalBytesReceived:" $obj.TotalBytesReceived
	write-host "TotalBytesSent:" $obj.TotalBytesSent
	write-host "TotalBytesTransferred:" $obj.TotalBytesTransferred
	write-host "TotalCGIRequests:" $obj.TotalCGIRequests
	write-host "TotalConnectionAttemptsallinstances:" $obj.TotalConnectionAttemptsallinstances
	write-host "TotalCopyRequests:" $obj.TotalCopyRequests
	write-host "TotalcountoffailedCALrequestsforauthenticatedusers:" $obj.TotalcountoffailedCALrequestsforauthenticatedusers
	write-host "TotalcountoffailedCALrequestsforSSLconnections:" $obj.TotalcountoffailedCALrequestsforSSLconnections
	write-host "TotalDeleteRequests:" $obj.TotalDeleteRequests
	write-host "TotalFilesReceived:" $obj.TotalFilesReceived
	write-host "TotalFilesSent:" $obj.TotalFilesSent
	write-host "TotalFilesTransferred:" $obj.TotalFilesTransferred
	write-host "TotalGetRequests:" $obj.TotalGetRequests
	write-host "TotalHeadRequests:" $obj.TotalHeadRequests
	write-host "TotalISAPIExtensionRequests:" $obj.TotalISAPIExtensionRequests
	write-host "TotalLockedErrors:" $obj.TotalLockedErrors
	write-host "TotalLockRequests:" $obj.TotalLockRequests
	write-host "TotalLogonAttempts:" $obj.TotalLogonAttempts
	write-host "TotalMethodRequests:" $obj.TotalMethodRequests
	write-host "TotalMethodRequestsPersec:" $obj.TotalMethodRequestsPersec
	write-host "TotalMkcolRequests:" $obj.TotalMkcolRequests
	write-host "TotalMoveRequests:" $obj.TotalMoveRequests
	write-host "TotalNonAnonymousUsers:" $obj.TotalNonAnonymousUsers
	write-host "TotalNotFoundErrors:" $obj.TotalNotFoundErrors
	write-host "TotalOptionsRequests:" $obj.TotalOptionsRequests
	write-host "TotalOtherRequestMethods:" $obj.TotalOtherRequestMethods
	write-host "TotalPostRequests:" $obj.TotalPostRequests
	write-host "TotalPropfindRequests:" $obj.TotalPropfindRequests
	write-host "TotalProppatchRequests:" $obj.TotalProppatchRequests
	write-host "TotalPutRequests:" $obj.TotalPutRequests
	write-host "TotalRejectedAsyncIORequests:" $obj.TotalRejectedAsyncIORequests
	write-host "TotalSearchRequests:" $obj.TotalSearchRequests
	write-host "TotalTraceRequests:" $obj.TotalTraceRequests
	write-host "TotalUnlockRequests:" $obj.TotalUnlockRequests
	write-host "TraceRequestsPersec:" $obj.TraceRequestsPersec
	write-host "UnlockRequestsPersec:" $obj.UnlockRequestsPersec
	write-host
	write-host "########"
	write-host
}