Powershell : Change Drive Letter

Here is a one line script that will query your computer for the CR-ROM and change the drive letter to G. Of course you can change the script to use any drive letter, just change g: to whatever letter you’d like.

(gwmi Win32_cdromdrive).drive | %{$a = mountvol $_ /l;mountvol $_ /d;$a = $a.Trim();mountvol g: $a}

Here is a link to a really nice script that can help with standardizing disks in a server deployment and is where I got the one liner from.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s