PowerShell code to remove DriveLetters for “System Reserved”Partition and CD-ROM

Depending on how the OS is installed, with Citrix PVS capture you may end up with “System Reserved” partition consuming a drive letter, Code below could be used during a machine startup script to provide a clean user experience. Also, included CD-ROM which I used for PVS BootISO and it is not really needed once the OS is loaded. Code validated on Server 2012 R2.

$SystemReservedDriveLetter=(Get-Volume | where {$_.FileSystemLabel -eq "System Reserved"}).DriveLetter
if ($SystemReservedDriveLetter -match  "[a-z]")
{
	mountvol "$SystemReservedDriveLetter`:" /d
}
$CDDriveLetter=(Get-Volume | where {$_.DriveType -eq "CD-ROM"}).DriveLetter
if ($CDDriveLetter -match  "[a-z]")
{
	mountvol "$CDDriveLetter`:" /d
}

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux