December 7th, 2015

PowerTip: Use PowerShell to Remove Drive Letter

Doctor Scripto
Scripter

Summary: Learn how to use Windows PowerShell to remove an assigned drive letter from a partition.

Hey, Scripting Guy! Question How can I use Windows PowerShell to remove a drive letter from a partition?

Hey, Scripting Guy! Answer Use a combination of three cmdlets with the drive letter—for example, to remove drive letter X from the drive
           it is assigned to, use

$DriveLetter=’X
Get-Volume -Drive $DriveLetter | Get-Partition | Remove-PartitionAccessPath
-accesspath "$DriveLetter`:\"

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.