1 minute read

I’ve been working a fair bit with WMI on Windows servers, in particular pulling out performance counters (will shortly be putting up another post about OpenNMS and WMI), and have found that Powershell is, once again, extremely useful.

Microsoft’s base WMI documentation online isn’t bad, but it’s a bit dated, and after days of searching I have still not found any documentation of ASP.NET WMI performance counters via Google.

Here are some useful commands in Powershell if you want to look at WMI, both to explore the WMI structure and to pull specific bits of data. Note that gwmi is an alias to the full Get-WmiObject command.

Find a WMI class using part of the name, in this case ASPNET.

gwmi -list | where {$_.name -match "ASPNET"}

Dump the contents of an entire WMI class, in this case Win32_PerfFormattedData_ASPNET_ASPNETApplications (you may also want to pipe to more).

gwmi Win32_PerfFormattedData_ASPNET_ASPNETApplications

Using WQL, which is just like SQL but for WMI, select specific records from a WMI class - in this case, select the EventsRaised counter from ASP.NET performance data for app pool with ID 1.

gwmi -query "select EventsRaised from Win32_PerfFormattedData_ASPNET_ASPNETApplications where name = '_LM_W3SVC_1_ROOT'"

That’s a good starting point, have fun!