Avatar of cgeorgeisaac
cgeorgeisaac
Flag for United States of America asked on

How to find the consolidated size of all the storage (Hard Disks) in Windows 2019?

I have a few Servers which has many HDs/Volumes in each server.  Is there an easier way to find the Total, Used and Available Space  of Each Storage in a consolidated manner? 
StorageWindows OS

Avatar of undefined
Last Comment
David Johnson, CD

8/22/2022 - Mon
David Johnson, CD

PowerShell
$toral = 0
$sizes = get-disk | select-object -ExpandProperty allocatedsize
foreach( $size in $sizes) {
$total += $size
}
$sizeGB = [math]::round($total/1TB,2)
write-output("Total Disk size for $env:computername is $sizeGB TB")

Open in new window

dbrunton

Line 1
I believe $toral should be $total
David Johnson, CD

yes     a typo  should be $total
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
cgeorgeisaac

ASKER
Many thanks David and dbrunton. That works great.

Is there any way I   find the total used and available space too?
ASKER CERTIFIED SOLUTION
David Johnson, CD

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.