Get-AvailableDriveLetter

Returns an array of the available drive letters.

Syntax

Get-AvailableDriveLetter
   [-ReturnFirstLetterOnly]

Description

Returns an array of all available drive letters, or optionally only the first available drive letter.

Examples

Example 1 - Get all available drive letters

PS C:\>Get-AvailableDriveLetter

Example 2 - Get the first available drive letter

PS C:\>Get-AvailableDriveLetter -ReturnFirstLetterOnly

Optional Parameters

-ReturnFirstLetterOnly
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.String

This cmdlet outputs an array of strings that stores the available drive letters.