Contact Info

Crumbtrail

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

Win32_PerfFormattedData_WRTCESPf jscript 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_WRTCESPf WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

var strComputer = ".";

var objWMIService = GetObject("winmgmts:\\\\" + strComputer + "\\root\\CIMV2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_WRTCESPf_LCUSrv00DBStore", "WQL");

var enumItems = new Enumerator(colItems);

for (; !enumItems.atEnd(); enumItems.moveNext()) {
	var objItem = enumItems.item();
	WScript.Echo("Caption: " + objItem.Caption);
	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("Name: " + objItem.Name);
	WScript.Echo("Timestamp_Object: " + objItem.Timestamp_Object);
	WScript.Echo("Timestamp_PerfTime: " + objItem.Timestamp_PerfTime);
	WScript.Echo("Timestamp_Sys100NS: " + objItem.Timestamp_Sys100NS);
	WScript.Echo("USrv000QueueDepth: " + objItem.USrv000QueueDepth);
	WScript.Echo("USrv002QueueLatencymsec: " + objItem.USrv002QueueLatencymsec);
	WScript.Echo("USrv004SprocLatencymsec: " + objItem.USrv004SprocLatencymsec);
	WScript.Echo("USrv006PercentDatabaseTime: " + objItem.USrv006PercentDatabaseTime);
	WScript.Echo("USrv008ThreadsWaitingforNewDatabaseRequests: " + objItem.USrv008ThreadsWaitingforNewDatabaseRequests);
	WScript.Echo("USrv009ThreadsExecutingDatabaseOperations: " + objItem.USrv009ThreadsExecutingDatabaseOperations);
	WScript.Echo("USrv010ThreadsCallingBackwithDatabaseResults: " + objItem.USrv010ThreadsCallingBackwithDatabaseResults);
	WScript.Echo("USrv011BlockedClientThreads: " + objItem.USrv011BlockedClientThreads);
	WScript.Echo("USrv013TotalDeadlocks: " + objItem.USrv013TotalDeadlocks);
	WScript.Echo("USrv014TotalDroppedRequests: " + objItem.USrv014TotalDroppedRequests);
	WScript.Echo("USrv015TotalDeadlockFailures: " + objItem.USrv015TotalDeadlockFailures);
	WScript.Echo("USrv016TotalTransactionCountMismatchFailures: " + objItem.USrv016TotalTransactionCountMismatchFailures);
	WScript.Echo("USrv017TotalODBCTimeoutFailures: " + objItem.USrv017TotalODBCTimeoutFailures);
	WScript.Echo("USrv018TotalsevereSQLerrors: " + objItem.USrv018TotalsevereSQLerrors);
	WScript.Echo("USrv019TotalfatalSQLerrors: " + objItem.USrv019TotalfatalSQLerrors);
	WScript.Echo("USrv020ThrottledrequestsPersec: " + objItem.USrv020ThrottledrequestsPersec);
	WScript.Echo("USrv021Totalthrottledrequests: " + objItem.USrv021Totalthrottledrequests);
	WScript.Echo("")
	WScript.Echo("########")
	WScript.Echo("")
}