Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .SYNOPSIS
- Removes the drive letter from a drive with the specified volume name.
- .DESCRIPTION
- Author: Mike Garvey
- Published: 12/1/2018
- Version: 1.0
- When imaging a UEFI-enabled workstation, SCCM incorrectly allows for the 'Recovery'
- partition to be assigned a drive letter. This script, when run at the end of a task
- sequence, removes this drive letter if it exists.
- .PARAMETER VolumeName
- The labeled volume name of the recovery drive. Normally, defaults to 'Recovery'.
- .INPUTS
- Does not accept pipeline input.
- .OUTPUTS
- None.
- .EXAMPLE
- .\RemoveDriveLetter.ps1 -VolumeName 'Recovery'
- .NOTES
- This script will not remove any drive letters on volumes that do NOT match the specified name.
- #>
- #Requires -Modules Storage -RunAsAdministrator
- [CmdletBinding(PositionalBinding=$false)]
- param
- (
- [parameter(Mandatory=$false)]
- [string] $VolumeName = "Recovery"
- )
- $volume = Get-Volume -FileSystemLabel $VolumeName;
- if ($null -ne $volume)
- {
- $volume | Get-Partition | Remove-PartitionAccessPath -AccessPath "$($volume.DriveLetter):\" -Confirm:$false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement