A customer reported some issues with obtaining performance counters from Exchange. in particular they wanted to access the MSExchangeIS\Rows in NamedProps Table“ Perfmon Counter using WMI. Using WMI, you can access system counter data programmatically from objects in the performance libraries using WMI performance classes. The customer had written a script to access several other performance counters using WMI but was having trouble with the NameProps specifically in Exchange.
In WMI, you can access a bunch of counters from the base class - Win32_PerfFormattedData.
Performance Counter Classes
Here is an example of obtaining performance counters ..
strComputer = "supernova.prod.com"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_PerfFormattedData_Perf_PerformanceCounter_PerformanceCounterSample",,48)
For Each objItem in colItems
Wscript.Echo "Win32_PerfFormattedData_Perf_PerformanceCounter_PerformanceCounterSample instance"
Wscript.Echo "raw: " & objItem.raw
But with exchange, you do have access to the Exchange_Mailbox Class but this only has methods/properties that return information about Microsoft® Exchange mailboxes.
Unfortunately Exchange 2007 RTM cut the support of WMI to manage/monitor the Exchange Server. However you should be fine using Powershell as the alternative, most of the counters from that should be available. What is be required is to use Powershell to read the data from the performance counters. Here is the generic Cmdlet to read this:
This will allow you to access these counters. However the customers basic problem was that they wanted to use these counters within a cscript because they were writing a monitor for SCOM.
Within SCOM, cscript has supported scripting environment and within some complex actions you can use powershell for some rules/monitors within SCOM. You can use powershell within System center operations manager but the customer wanted a way to access these kind of counters from within cscript instead. Microsoft Operations Manager 2007 R2 now includes the ability to run Windows PowerShell scripts from within management packs by using new module types provided in the Windows Core Library management pack.
This concluded that the best way to go was to use powershell (within COM) to access the counters and not be using WMI in a CSCRIPT-Environment.