PSTip: Change a drive letter using Win32_Volume class
Changing a drive letter of a removable drive or DVD drive is an easy task with Windows PowerShell. Using the Win32_Volume class and the Set-CimInstance cmdlet a drive letter can be reassigned. The following code will change the drive letter for the F: drive and change the drive letter to Z:
|
|
Alternatively this can also be executed in a single line of code by using the pipeline:
|
|
For more information about the Win32_Volume class have a look at the MSDN entry here:
Share on: