Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Problem Changing Drive Letter

$
0
0

Hi all,

I'm having issues trying to change a Drive letter of external drives. The script I use is below.

$drive = Get-WmiObject -Class Win32_Volume -Authentication 6 | where {$_.DeviceID -like "*a2084369-d78a-11e3-a846-b8ac6f885230*"}

Set-WmiInstance -input $drive -Arguments @{DriveLetter="R:"}

I'm testing with 3 different drives right now. 1 of them works perfectly, the other 2 fail with the following message.

Set-WmiInstance : Not available

At C:\Chris Test\driveMount.ps1:5 char:1

+ Set-WmiInstance -input $drive3 -Arguments @{DriveLetter="R:"}

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [Set-WmiInstance], ManagementException

    + FullyQualifiedErrorId : SetWMIManagementException,Microsoft.PowerShell.Commands.SetWmiInstance

I'm new to PowerShell, so I'm not quite sure what's going on. I can change the Label on the failing drives, but not the drive letter.

 

Any ideas?

 

EDIT: PowerShell V4, Window Server 2008 R2


Viewing all articles
Browse latest Browse all 8411

Trending Articles