If anyone is interested, the contents of this repository will allow you low level discover and monitor individual disks on a Windows machine. Let me know if any of the returned metrics are incorrect.
Ad Widget
Collapse
Low Level Discovery Physical Disk Windows Performance Monitoring
Collapse
X
-
Tags: None
-
Writing Code
I need to write the code so that it takes into account multiple disk partitions on the disks. If you have multiple disk partitions that have drive letters assigned, the items will become unsupported.Comment
-
Fixed
It should now be working with multiple partitions with drive letters. I hope you all enjoy.Comment
-
Total Rewrite
Works great now.
Code:$drives = typeperf -qx physicaldisk | findstr /r "Idle" | select-string -pattern "[0-9]\s[a-z]:((\s[a-z]:)+(\s)?)?" -allmatches -list | select matches write-host "{" write-host " `"data`":[`n" foreach ($perfDrives in $drives) { $line= "{ `"{#DISKNUMLET}`" : `"" + $perfDrives.matches + "`" }," write-host $line } write-host write-host " ]" write-host "}" write-hostLast edited by vintagegamingsystems; 15-10-2013, 17:31.Comment
-
Small update
In v.2.4 you'll get "invalid JSON (...)" error. The problem is the comma in the last line. This would do the job:
Code:$drives = typeperf -qx physicaldisk | findstr /r "Idle" | select-string -pattern "[0-9]\s[a-z]:((\s[a-z]:)+(\s)?)?" -allmatches -list | select matches write-host "{" write-host " `"data`":[`n" #temp variable $temp = 1 foreach ($perfDrives in $drives) { if ($temp -eq 0){ Write-Host ","; } else{ $temp = 0; } $line= "{ `"{#DISKNUMLET}`" : `"" + $perfDrives.matches + "`" }" Write-Host -NoNewline $line } # Close the JSON message write-host write-host " ]" write-host "}" write-hostComment
Comment