You may use the script below to query the drive letters, drive sizes, and the amount of free space on each drive in gigabytes (GB) for the local host.
<#
.SYNOPSIS
This script will provide the drive letter, drive size and free space of the local server.
.DESCRIPTION
This script will automate the process of providing the drive letter, drive size and free space of the local server.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Wednesday, March 23, 2016.
#>
#Provide the hard drive information for the local server
Get-WmiObject Win32_LogicalDisk -Filter ‘DriveType = 3′ `
| select SystemName, DeviceID,
@{n=’Size’;e={[int]($_.Size/1GB)}},
@{n=’FreeSpace’;e={[int]($_.FreeSpace/1GB)}}