1

I'm trying to get \DBServer\SQLServer:Buffer Manager\Page life expectancy data through WMI. When I do this through perfmon, I get actual data. However when I try and pull this from either of these WMI classes(which I believe should be correct) it always returns 0: Win32_PerfFormattedData_MSSQLSERVER_SQLServerBufferManager Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager

Using WMIExplorer it returns 0's across all columns in both WMI classes.

The PerfLog has data: "07/08/2010 12:02:53.986","4429"
"07/08/2010 12:03:08.989","4429"
"07/08/2010 12:03:23.991","4429"
"07/08/2010 12:03:38.994","4429"
"07/08/2010 12:03:53.996","3415"
"07/08/2010 12:04:08.999","3415"
"07/08/2010 12:04:24.001","3415"

Where else would this data be stored so that I could get it through WMI?

1 Answers1

0

You don't say what property you are calling on for the WMI classes. The PageLifeExpectancy property should have the same data as Perfmon. Try this vbscript:

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = "SQLSERVER"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_MSSQLSERVER_SQLServerBufferManager", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
    WScript.Echo "Pagelifeexpectancy: " & objItem.Pagelifeexpectancy
Next

(edit) Sorry, you actually do say that all columns return zero. Try the script anyway, just in case you are doing something different. I have tested it on an SQL Server 2008 machine and it gives the same data as Perfmon.

Torai
  • 404
  • 2
  • 5