Win32_PerfFormattedData_MSSQLSERVER 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_MSSQLSERVER 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_MSSQLSERVER_SQLServerAccessMethods" foreach ($obj in $objWmi) { write-host "AUcleanupbatchesPersec:" $obj.AUcleanupbatchesPersec write-host "AUcleanupsPersec:" $obj.AUcleanupsPersec write-host "ByreferenceLobCreateCount:" $obj.ByreferenceLobCreateCount write-host "ByreferenceLobUseCount:" $obj.ByreferenceLobUseCount write-host "Caption:" $obj.Caption write-host "CountLobReadahead:" $obj.CountLobReadahead write-host "CountPullInRow:" $obj.CountPullInRow write-host "CountPushOffRow:" $obj.CountPushOffRow write-host "DeferreddroppedAUs:" $obj.DeferreddroppedAUs write-host "DeferredDroppedrowsets:" $obj.DeferredDroppedrowsets write-host "Description:" $obj.Description write-host "DroppedrowsetcleanupsPersec:" $obj.DroppedrowsetcleanupsPersec write-host "DroppedrowsetsskippedPersec:" $obj.DroppedrowsetsskippedPersec write-host "ExtentDeallocationsPersec:" $obj.ExtentDeallocationsPersec write-host "ExtentsAllocatedPersec:" $obj.ExtentsAllocatedPersec write-host "FailedAUcleanupbatchesPersec:" $obj.FailedAUcleanupbatchesPersec write-host "Failedleafpagecookie:" $obj.Failedleafpagecookie write-host "Failedtreepagecookie:" $obj.Failedtreepagecookie write-host "ForwardedRecordsPersec:" $obj.ForwardedRecordsPersec write-host "FreeSpacePageFetchesPersec:" $obj.FreeSpacePageFetchesPersec write-host "FreeSpaceScansPersec:" $obj.FreeSpaceScansPersec write-host "Frequency_Object:" $obj.Frequency_Object write-host "Frequency_PerfTime:" $obj.Frequency_PerfTime write-host "Frequency_Sys100NS:" $obj.Frequency_Sys100NS write-host "FullScansPersec:" $obj.FullScansPersec write-host "IndexSearchesPersec:" $obj.IndexSearchesPersec write-host "LobHandleCreateCount:" $obj.LobHandleCreateCount write-host "LobHandleDestroyCount:" $obj.LobHandleDestroyCount write-host "LobSSProviderCreateCount:" $obj.LobSSProviderCreateCount write-host "LobSSProviderDestroyCount:" $obj.LobSSProviderDestroyCount write-host "LobSSProviderTruncationCount:" $obj.LobSSProviderTruncationCount write-host "MixedpageallocationsPersec:" $obj.MixedpageallocationsPersec write-host "Name:" $obj.Name write-host "PagecompressionattemptsPersec:" $obj.PagecompressionattemptsPersec write-host "PageDeallocationsPersec:" $obj.PageDeallocationsPersec write-host "PagesAllocatedPersec:" $obj.PagesAllocatedPersec write-host "PagescompressedPersec:" $obj.PagescompressedPersec write-host "PageSplitsPersec:" $obj.PageSplitsPersec write-host "ProbeScansPersec:" $obj.ProbeScansPersec write-host "RangeScansPersec:" $obj.RangeScansPersec write-host "ScanPointRevalidationsPersec:" $obj.ScanPointRevalidationsPersec write-host "SkippedGhostedRecordsPersec:" $obj.SkippedGhostedRecordsPersec write-host "TableLockEscalationsPersec:" $obj.TableLockEscalationsPersec write-host "Timestamp_Object:" $obj.Timestamp_Object write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS write-host "Usedleafpagecookie:" $obj.Usedleafpagecookie write-host "Usedtreepagecookie:" $obj.Usedtreepagecookie write-host "WorkfilesCreatedPersec:" $obj.WorkfilesCreatedPersec write-host "WorktablesCreatedPersec:" $obj.WorktablesCreatedPersec write-host "WorktablesFromCacheRatio:" $obj.WorktablesFromCacheRatio write-host write-host "########" write-host }