Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI Performance Counters » VBScript

SQLServerDatabases - WMI sample in VBScript

The foundations for Manageability in Windows 2019/2012/2008/ and Windows 10/8/7/Vista/XP are 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.

On this site, you can find many WMI samples.

The SQLServerDatabases WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


SQLServerDatabases

Example(s)

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_PerfFormattedData_MSSQLSERVER_SQLServerDatabases")

For Each objItem in colItems
	WScript.Echo "ActiveTransactions:" & objItem.ActiveTransactions
	WScript.Echo "BackupPerRestoreThroughputPersec:" & objItem.BackupPerRestoreThroughputPersec
	WScript.Echo "BulkCopyRowsPersec:" & objItem.BulkCopyRowsPersec
	WScript.Echo "BulkCopyThroughputPersec:" & objItem.BulkCopyThroughputPersec
	WScript.Echo "Caption:" & objItem.Caption
	WScript.Echo "Committableentries:" & objItem.Committableentries
	WScript.Echo "DataFilesSizeKB:" & objItem.DataFilesSizeKB
	WScript.Echo "DBCCLogicalScanBytesPersec:" & objItem.DBCCLogicalScanBytesPersec
	WScript.Echo "Description:" & objItem.Description
	WScript.Echo "Frequency_Object:" & objItem.Frequency_Object
	WScript.Echo "Frequency_PerfTime:" & objItem.Frequency_PerfTime
	WScript.Echo "Frequency_Sys100NS:" & objItem.Frequency_Sys100NS
	WScript.Echo "LogBytesFlushedPersec:" & objItem.LogBytesFlushedPersec
	WScript.Echo "LogCacheHitRatio:" & objItem.LogCacheHitRatio
	WScript.Echo "LogCacheReadsPersec:" & objItem.LogCacheReadsPersec
	WScript.Echo "LogFilesSizeKB:" & objItem.LogFilesSizeKB
	WScript.Echo "LogFilesUsedSizeKB:" & objItem.LogFilesUsedSizeKB
	WScript.Echo "LogFlushesPersec:" & objItem.LogFlushesPersec
	WScript.Echo "LogFlushWaitsPersec:" & objItem.LogFlushWaitsPersec
	WScript.Echo "LogFlushWaitTime:" & objItem.LogFlushWaitTime
	WScript.Echo "LogGrowths:" & objItem.LogGrowths
	WScript.Echo "LogShrinks:" & objItem.LogShrinks
	WScript.Echo "LogTruncations:" & objItem.LogTruncations
	WScript.Echo "Name:" & objItem.Name
	WScript.Echo "PercentLogUsed:" & objItem.PercentLogUsed
	WScript.Echo "ReplPendingXacts:" & objItem.ReplPendingXacts
	WScript.Echo "ReplTransRate:" & objItem.ReplTransRate
	WScript.Echo "ShrinkDataMovementBytesPersec:" & objItem.ShrinkDataMovementBytesPersec
	WScript.Echo "Timestamp_Object:" & objItem.Timestamp_Object
	WScript.Echo "Timestamp_PerfTime:" & objItem.Timestamp_PerfTime
	WScript.Echo "Timestamp_Sys100NS:" & objItem.Timestamp_Sys100NS
	WScript.Echo "TrackedtransactionsPersec:" & objItem.TrackedtransactionsPersec
	WScript.Echo "TransactionsPersec:" & objItem.TransactionsPersec
	WScript.Echo "WriteTransactionsPersec:" & objItem.WriteTransactionsPersec
	WScript.Echo ""
	WScript.Echo "########"
	WScript.Echo ""
Next