#PSTip Persistent file system drives
In the previous tip we showed you how to get the next available drive letter using the Get-AvailableDriveLetter function when we want to create a new mapped network drive.
The Get-AvailableDriveLetter function is one of the commands in the Storage module in Windows 8 and Server 2012.
Starting with PowerShell 3.0, we can now map persistent drives using the enhanced New-PSDrive cmdlet. The following command uses the Get-AvailableDriveLetter function together with the New-PSDrive cmdlet and its -Persist parameter to map a persistent drive:
PS> $letter = Get-AvailableDriveLetter -ReturnFirstLetterOnly PS> New-PSDrive -Name $letter -PSProvider FileSystem -Root \\Server01\Share -Persist
To disconnect the drive:
PS> Remove-PSDrive -Name $letterShare on: