0

How can I get the "Highest Active Time" of the drives programmatically?

I can see it on Resources Monitor, but I want to get it programmatically with a script (VBScript, Batch) or application, so I can upload the status of my servers to a database without the need to check each one manually.

Also, is possible to get this status without adminstrator rights?

Thanks

1 Answer 1

2

The "Highest Active Percentage" that you see in Resource Monitor is simply the highest active time seen BY Resource Monitor over the time it gathers the statistics, and isn't something that the system keeps for you. What you can do is gather the relevant statistic yourself on a periodic basis and use it to work it out.

You can get disk usage statistcs using WMI; an example PowerShell script to get the current PercentDiskTime statistic for all disks at this point in time would be:

$wmi = Get-WMIObject -Class "Win32_PerfFormattedData_PerfDisk_PhysicalDisk" -Filter 'Name = "_Total"'
$wmi.PercentDiskTime

You can filter on the expression to get the statistics you want, or change the -Filter 'Name = "_Total"' parameter to change to the disk you're interested in, or even remove it altogether if you want stats for everything.

You can use this to work out the highest value your script has seen so far.

6
  • I tried running these commands in PowerShell, but it returned a syntax error. Never messed with PowerShell before, but I'm familiar with Batch scripts, so I corrected it. >>$wmi = Get-WMIObject -Class Win32_PerfFormattedData_PerfDisk_PhysicalDisk -Filter "Name='_Total'" >>$wmi.PercentDiskTime
    – LuizLoyola
    Jun 9, 2017 at 17:55
  • Oops...corrected the typos now. Is that what you wanted?
    – Pak
    Jun 9, 2017 at 17:57
  • Keep in mind that WMI will only work with Windows PowerShell (version 5.x or less).
    – brianary
    Mar 5, 2021 at 18:17
  • Right now, I'm getting values between 30 and 340, which seems high for a percentage (207, 331, 185, 175, 37 , 30 , 30 , 30 , 340, 33 , 167).
    – brianary
    Mar 5, 2021 at 18:20
  • Oh, I see, filtering to _Total is summing the percentage across all of my drives. I can also filter to a specific drive.
    – brianary
    Mar 5, 2021 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.