It has always irritated me that I cannot export data from the disk management snap-in in Windows. Take this example from an Exchange server:
It would be very nice to be able to export this data to a CSV to create a quick storage report. Unfortunately you can’t. But with PowerShell you can!
This command will export the same data:
Get-WmiObject win32_volume | select Name,Label,@{Name=”Capacity (GB)”; Expression={“{0:N2}” –f ($_.capacity/1GB)}},@{Name=”Free Space (GB)”; Expression={“{0:N2}” -f ($_.freespace/1GB)}},@{Name=”Used Space (GB)”; Expression={“{0:N2}” -f ( ($_.capacity/1GB) – ($_.freespace/1GB) ) }} | ft –AutoSize
The result:
Name Label Capacity (GB) Free Space (GB) Used Space (GB)
—- —– ————- ————— —————
C: 72,50 18,17 54,33
E:LogLUN1 ExchangeLogs 1 249,87 1 245,32 4,55
E: Exchange 0,97 0,93 0,03
E:DBLUN1 DBLUN1 2 046,87 1 358,92 687,95
E:DBLUN2 DBLUN2 2 046,87 1 467,69 579,19
E:DBLUN3 DBLUN3 2 046,87 1 527,84 519,03
E:DBLUN4 DBLUN4 499,87 375,19 124,68
Of course, you can export this to CSV etc.