Contact Info

Crumbtrail

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

Win32_PerfRawData_ESENT 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_ESENT 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_ESENT_Database"

foreach ($obj in $objWmi)
{
	write-host "Caption:" $obj.Caption
	write-host "DatabaseCacheMissesPersec:" $obj.DatabaseCacheMissesPersec
	write-host "DatabaseCachePercentHit:" $obj.DatabaseCachePercentHit
	write-host "DatabaseCachePercentHit_Base:" $obj.DatabaseCachePercentHit_Base
	write-host "DatabaseCacheRequestsPersec:" $obj.DatabaseCacheRequestsPersec
	write-host "DatabaseCacheSize:" $obj.DatabaseCacheSize
	write-host "DatabaseCacheSizeMB:" $obj.DatabaseCacheSizeMB
	write-host "DatabaseCacheSizeResident:" $obj.DatabaseCacheSizeResident
	write-host "DatabaseCacheSizeResidentMB:" $obj.DatabaseCacheSizeResidentMB
	write-host "DatabasePageEvictionsPersec:" $obj.DatabasePageEvictionsPersec
	write-host "DatabasePageFaultsPersec:" $obj.DatabasePageFaultsPersec
	write-host "DatabasePageFaultStallsPersec:" $obj.DatabasePageFaultStallsPersec
	write-host "DefragmentationTasks:" $obj.DefragmentationTasks
	write-host "DefragmentationTasksPending:" $obj.DefragmentationTasksPending
	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 "IODatabaseReadsAverageLatency:" $obj.IODatabaseReadsAverageLatency
	write-host "IODatabaseReadsAverageLatency_Base:" $obj.IODatabaseReadsAverageLatency_Base
	write-host "IODatabaseReadsPersec:" $obj.IODatabaseReadsPersec
	write-host "IODatabaseWritesAverageLatency:" $obj.IODatabaseWritesAverageLatency
	write-host "IODatabaseWritesAverageLatency_Base:" $obj.IODatabaseWritesAverageLatency_Base
	write-host "IODatabaseWritesPersec:" $obj.IODatabaseWritesPersec
	write-host "IOLogReadsPersec:" $obj.IOLogReadsPersec
	write-host "IOLogWritesAverageLatency:" $obj.IOLogWritesAverageLatency
	write-host "IOLogWritesAverageLatency_Base:" $obj.IOLogWritesAverageLatency_Base
	write-host "IOLogWritesPersec:" $obj.IOLogWritesPersec
	write-host "LogBytesGeneratedPersec:" $obj.LogBytesGeneratedPersec
	write-host "LogBytesWritePersec:" $obj.LogBytesWritePersec
	write-host "LogRecordStallsPersec:" $obj.LogRecordStallsPersec
	write-host "LogThreadsWaiting:" $obj.LogThreadsWaiting
	write-host "LogWritesPersec:" $obj.LogWritesPersec
	write-host "Name:" $obj.Name
	write-host "PagesConverted:" $obj.PagesConverted
	write-host "PagesConvertedPersec:" $obj.PagesConvertedPersec
	write-host "RecordsConverted:" $obj.RecordsConverted
	write-host "RecordsConvertedPersec:" $obj.RecordsConvertedPersec
	write-host "SessionsInUse:" $obj.SessionsInUse
	write-host "SessionsPercentUsed:" $obj.SessionsPercentUsed
	write-host "SessionsPercentUsed_Base:" $obj.SessionsPercentUsed_Base
	write-host "TableOpenCacheHitsPersec:" $obj.TableOpenCacheHitsPersec
	write-host "TableOpenCacheMissesPersec:" $obj.TableOpenCacheMissesPersec
	write-host "TableOpenCachePercentHit:" $obj.TableOpenCachePercentHit
	write-host "TableOpenCachePercentHit_Base:" $obj.TableOpenCachePercentHit_Base
	write-host "TableOpensPersec:" $obj.TableOpensPersec
	write-host "Timestamp_Object:" $obj.Timestamp_Object
	write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime
	write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS
	write-host "Versionbucketsallocated:" $obj.Versionbucketsallocated
	write-host
	write-host "########"
	write-host
}