Home > Software engineering >  Get Total disk space mentioned in server manager
Get Total disk space mentioned in server manager

Time:11-12

I need help in getting the "Total disk space" mentioned in server manager

enter image description here

I tried searching but I am not getting anything.

$total=0;Get-WmiObject Win32_Volume | ForEach-Object {$total  = [Math]::Round((($_.Capacity - $_.FreeSpace) / 1GB),2)};Write-Output "TotalUsedSpace_GB : $total"

Please let me know how to get this value

CodePudding user response:

(Get-Disk | measure-object -Property size -Sum).Sum / 1GB

or

(Get-Partition | measure-object -property size -Sum).Sum / 1GB

are both within ~500MB.

  • Related