Contact Info

Crumbtrail

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

Win32_PerfFormattedData_APIPerf 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_APIPerf 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_APIPerf_LCAPI00APIApplicationInstanceCounters"

foreach ($obj in $objWmi)
{
	write-host "API000TransactionEventsProcessedPerSec:" $obj.API000TransactionEventsProcessedPerSec
	write-host "API001MessagesProcessedPerSec:" $obj.API001MessagesProcessedPerSec
	write-host "API002ActiveTransactionsContexts:" $obj.API002ActiveTransactionsContexts
	write-host "API003RequestTransactionsProcessed:" $obj.API003RequestTransactionsProcessed
	write-host "API004ResponseTransactionsProcessed:" $obj.API004ResponseTransactionsProcessed
	write-host "API005ACKTransactionsProcessed:" $obj.API005ACKTransactionsProcessed
	write-host "API006BENOTIFYTransactionsProcessed:" $obj.API006BENOTIFYTransactionsProcessed
	write-host "API007TimeoutTransactionsProcessed:" $obj.API007TimeoutTransactionsProcessed
	write-host "API008CancelTransactionsProcessed:" $obj.API008CancelTransactionsProcessed
	write-host "API009RequestssimpleproxiedfromSPL:" $obj.API009RequestssimpleproxiedfromSPL
	write-host "API010RequestssimpleproxiedfromSPLPerSec:" $obj.API010RequestssimpleproxiedfromSPLPerSec
	write-host "API011ResponsessimpleproxiedfromSPL:" $obj.API011ResponsessimpleproxiedfromSPL
	write-host "API012ResponsessimpleproxiedfromSPLPerSec:" $obj.API012ResponsessimpleproxiedfromSPLPerSec
	write-host "API013RequestssimpleproxiedfromServerAgent:" $obj.API013RequestssimpleproxiedfromServerAgent
	write-host "API014RequestssimpleproxiedfromServerAgentPerSec:" $obj.API014RequestssimpleproxiedfromServerAgentPerSec
	write-host "API015ResponsessimpleproxiedfromServerAgent:" $obj.API015ResponsessimpleproxiedfromServerAgent
	write-host "API016ResponsessimpleproxiedfromServerAgentPerSec:" $obj.API016ResponsessimpleproxiedfromServerAgentPerSec
	write-host "API017Requestsforwardedusingforkingproxy:" $obj.API017Requestsforwardedusingforkingproxy
	write-host "API018RequestsforwardedusingforkingproxyPerSec:" $obj.API018RequestsforwardedusingforkingproxyPerSec
	write-host "API019Responsesforwardedusingforkingproxy:" $obj.API019Responsesforwardedusingforkingproxy
	write-host "API020ResponsesforwardedusingforkingproxyPerSec:" $obj.API020ResponsesforwardedusingforkingproxyPerSec
	write-host "API021Locallygeneratedresponses:" $obj.API021Locallygeneratedresponses
	write-host "API022ApplicationScriptErrors:" $obj.API022ApplicationScriptErrors
	write-host "API023SystemErrorsIgnored:" $obj.API023SystemErrorsIgnored
	write-host "API024DispatchNotificationCalls:" $obj.API024DispatchNotificationCalls
	write-host "API025DispatchNotificationCallsPerSec:" $obj.API025DispatchNotificationCallsPerSec
	write-host "API026TransactionsPendingDispatchCompletion:" $obj.API026TransactionsPendingDispatchCompletion
	write-host "API027Dispatchcallstimedout:" $obj.API027Dispatchcallstimedout
	write-host "API028DispatchCallsTimedoutPerSec:" $obj.API028DispatchCallsTimedoutPerSec
	write-host "API029SAWriteQueueMaximumLength:" $obj.API029SAWriteQueueMaximumLength
	write-host "API030SAWriteQueueLength:" $obj.API030SAWriteQueueLength
	write-host "API031QueuedSABatchesPerSec:" $obj.API031QueuedSABatchesPerSec
	write-host "API032ASReadQueueLength:" $obj.API032ASReadQueueLength
	write-host "API033DequeuedASBatchesPerSec:" $obj.API033DequeuedASBatchesPerSec
	write-host "API034SAReadQueueLength:" $obj.API034SAReadQueueLength
	write-host "API035ASWriteQueueLength:" $obj.API035ASWriteQueueLength
	write-host "API036SAQueueFreeBytesKB:" $obj.API036SAQueueFreeBytesKB
	write-host "API037ASQueueFreeBytesKB:" $obj.API037ASQueueFreeBytesKB
	write-host "API038ApplicationDispatchfailures:" $obj.API038ApplicationDispatchfailures
	write-host "Caption:" $obj.Caption
	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 "Name:" $obj.Name
	write-host "Timestamp_Object:" $obj.Timestamp_Object
	write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime
	write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS
	write-host
	write-host "########"
	write-host
}