How To: Change a Drive Letter With PowerShell [Field Notes]
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:";}
Leave a comment