Get drive letter (Device ID), Drive size, drive free space and drive free space %

Production DBA expertise evolving into a modern DBA operations platform.

Get-WmiObject Win32_logicaldisk -ComputerName ADD Your Server Name `

| Format-Table DeviceID, `

@{Name=”Drive Size(GB)”;Expression={[decimal](“{0:N0}” -f($_.size/1gb))}}, `

@{Name=”Drive Free Space(GB)”;Expression={[decimal](“{0:N0}” -f($_.freespace/1gb))}}, `

@{Name=”Drive Free pct”;Expression={“{0,6:P0}” -f(($_.freespace/1gb) / ($_.size/1gb))}} `

-AutoSize 


Discover more from SQLYARD

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from SQLYARD

Subscribe now to keep reading and get access to the full archive.

Continue reading