Reputation: 2599
I am trying to find a powershell (or WMI) query to find the sum of disk space utilization in a PC. I have the following query...
But as you can see in the image, it is showing separate rows for each drive. How Can I get the total of disk space.
Sebastian
Upvotes: 2
Views: 5207
Reputation: 46710
Measure-Object
should do that work for you nicely. You didnt say what data you were looking for exactly so this would give both sums of FreeSpace
and Size
.
Get-WmiObject -class win32_logicaldisk | Measure-Object -Sum freespace,size
-or-
Get-WmiObject -class win32_logicaldisk | Measure-Object -Sum size
You need to extract the sum from that for it to be useful.
Upvotes: 5