Display maximum and minimum FreeSpace in a logical disk

Execute the script to find the maximum and minimum space in a local disk.

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

 

Output
disk

Leave a Reply