How To: Change a Drive Letter With PowerShell [Field Notes]

less than 1 minute read | Suggest an edit | Issue? Question?

Problem:

I need to change the letter of a mounted drive via PowerShell.

Solution

Start Powershell as an admin and run the following two lines, where ‘x’ is the current drive letter and y is the drive letter you’d like it to be:

$drive = Get-WmiObject -Class win32_volume -Filter "DriveLetter = 'x:'"
Set-WmiInstance -input $drive -Arguments @{DriveLetter="Y:";}

Updated:

Leave a comment