WMI Win32_PerfFormattedData_PerfDisk_PhysicalDisk - read/write reading 0 in XP, but ok in 2008/7 RRS feed

  • Question

  • Hello,

    I am starting to toy around with Vb and so just to pre-warn you about me been a noobie at this!

    I am trying to write an application which pulls various performance statistics from a workstation/server to log into a SQL table. 

    Last night I coded and tested a HDD read/write bytes data, collecting the data from WMI query:


      colDisks = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_PerfDisk_PhysicalDisk where name='_total'")
      For Each objDisk In colDisks
       HDDReadCount = Math.Round(objDisk.DiskReadBytesPerSec / 1048576, 2)
       HDDWriteCount = Math.Round(objDisk.DiskWriteBytesPerSec / 1048576, 2)
       HDDQueueCount = Math.Round(objDisk.CurrentDiskQueueLength / 1048576, 2)

    This ran fine on Windows 7 and Server 2008 R2 read, write and queue report data when there is disk activity and looked correct.

    However, run the same app on a WinXP machine (SP2 and SP3) and the result is just 0, with the read one will bounce between 0 and a higher value when data is been read from the drive...

    I then tried pulling the info directly from the performance monitor - that had the same effect :(

    Any advice?

    Monday, May 17, 2010 10:42 AM