PowerShell: Disk Freespace Display

Display maximum and minimum FreeSpace in a logical disk

It is paramount for IT admins to check the available disk space in a particular system before pushing out an update or installing an application. However, to do so at scale can be intimidating, as it can quickly get out of hand.
 
With the following script, one can check the available maximum and minimum disk space of a computer easily.

Script

<#
.SYNOPSIS
This script can be used to find the maximum and minimum space in a local disk.
.DESCRIPTION
This script can be used to find the maximum and minimum space in a local disk.
.EXAMPLE
C:\PS> C:\Script\Logical_disk.ps1
Displays the maximum and minimum free space available in local disk.
#>
#identify if the drivetype is 3 for local harddrive and obtain the ‘freespace’ to find the maximum and minimum free space.

$objectdisk=gwmi win32_logicaldisk -filter drivetype=3 | Measure-object freespace -Minimum -Maximum | Select-Object -Property property,maximum,minimum
$objectdisk | Format-Table -autosize