By default, Windows will assign the next available letter to your CD/DVD ROM drive. For servers and even workstation, it could be useful to change it to a standard value. This post will describe how SCCM Change Drive Letter in an OSD task sequence.

In computer data storagedrive letter assignment is the process of assigning alphabetical identifiers to volumes. As an SCCM admin, you should always find ways to optimize your work and stop doing repetitive tasks.

Add a Run Command Line step at the end of your task sequence that runs a PowerShell command.

The latest SCCM 1902 Version can now directly enter Windows PowerShell code in the Run PowerShell Script step. This change lets you run PowerShell commands during a task sequence without first creating and distributing a package with the script.

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command “(gwmi Win32_cdromdrive).drive | %{$a = mountvol $_ /l;mountvol $_ /d;$a = $a.Trim();mountvol z: $a}”

You change the last Z: to another letter to fit your environment. This will make Drive Letter change in your Task Sequence.

SCCM Change Drive Letter
SCCM Change Drive Letter

A simple script to make your SCCM Admin life easier. Let us know if this tip was helpful for you by using the comment section.

Comments (5)

free proxy

06.08.2019 AT 10:34 AM
Hello,I log on to your new stuff named "Change CDROM Drive Letter using Powershell during OSD" daily.Your writing style is awesome, keep doing what you're doing! And you can look our website about free proxy.

MrRedHead

12.04.2017 AT 12:44 PM
The scripts fails if there is a cdrom drive which isn't mounted. How to make it fail-safe?

David

03.01.2015 AT 05:46 PM
Got multiple CD drives? Then try this: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command "$z=90; (gwmi Win32_cdromdrive).drive | %{$a=mountvol $_ /l; mountvol $_ /d; $a=$a.Trim(); $l=[char]$z+\":\"; mountvol $l $a; $z=$z-1}"

Robert

02.10.2015 AT 10:24 AM
Fix your backslashes, as it stands the script fragment is a complete failure.

Benoit Lecours

02.10.2015 AT 10:50 AM
Thanks Robert for pointing that out. It has been fixed.