Link to home
Start Free TrialLog in
Avatar of NetRock6
NetRock6Flag for Canada

asked on

PowerShell: Force to change the Drive Letter

Using the below Powershell command, I am trying to change the drive but it fails with error: "drive is in used"
is there a way to force it to change as we can change in the Windows Dick Management Console
Get-Partition -DiskNumber 1 | Set-Partition -NewDriveLetter G

Open in new window


Thanks.... ;)
Avatar of Hayes Jupe
Hayes Jupe
Flag of Australia image

I haven't tested this - but I believe using wmi via powershell will yield a better result... e.g.

$drive = Get-WmiObject -Class win32_volume -Filter "DriveLetter = 'x:'"

Set-WmiInstance -input $drive -Arguments @{DriveLetter="G:"; Label="Label"}

I am also interested in this version of windows you have which has "change in the Windows Dick Management Console" - I've not seen a dick management console - but it is the funniest typo I've seen in a while - thanks for the laugh!
Can you restart your system once and check if you can change drive letter. Command you mentioned is the easiest way to do it.
try setting the drive offline, set the drive letter set the drive online
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial