Param($DriveLetter) if ($PSBoundParameters.Count -ne 1) { exit } $DriveLetter = $DriveLetter.Substring(0,1) try { $free = (Get-PSDrive -Name $DriveLetter -ErrorAction Stop).Free return ($free / 1024 / 1024 / 1024) } catch { exit }