< Back

Get-MrAvailableDriveLetter

Sat Jan 18, 2020 4:35 pm

NAME Get-MrAvailableDriveLetter



SYNOPSIS

Returns one or more available drive letters.





SYNTAX

Get-MrAvailableDriveLetter [[-ExcludeDriveLetter] <String[]>] [-Random] [-All] [<CommonParameters>]





DESCRIPTION

Get-MrAvailableDriveLetter is an advanced PowerShell function that returns one or more available

drive letters depending on the specified parameters.





PARAMETERS

-ExcludeDriveLetter <String[]>

Drive letter(s) to exclude regardless if they're available or not. The default excludes drive letters

A-F and Z.



Required? false

Position? 1

Default value ('A-F', 'Z')

Accept pipeline input? false

Accept wildcard characters? false



-Random [<SwitchParameter>]

Return one or more available drive letters at random instead of the next available drive letter.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-All [<SwitchParameter>]

Return all available drive letters. The default is to only return the first available drive letter.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None





OUTPUTS

String





NOTES





Author: Mike F Robbins

Website: http://mikefrobbins.com

Twitter: @mikefrobbins



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-MrAvailableDriveLetter













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-MrAvailableDriveLetter -ExcludeDriveLetter A-C













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-MrAvailableDriveLetter -Random













-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-MrAvailableDriveLetter -All













-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-MrAvailableDriveLetter -ExcludeDriveLetter A-C, M, Q, T, W-Z -All













-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Get-MrAvailableDriveLetter -Random -All













-------------------------- EXAMPLE 7 --------------------------



PS C:\\>Get-MrAvailableDriveLetter -ExcludeDriveLetter $null -Random -All















RELATED LINKS