Partager via


How do I assign a drive letter in the Format and Partition Disk step?

The short answer is, "you can't".  Drive letters are only applicable to an instance of a running operating system.  Any drive letters assigned in Windows PE would not be persisted when you reboot into the new operating system (or when you reboot to Windows PE for that matter), which will re-enumerate the drives and assign letters using its own heuristics.

Some people have been concerned that after they partition and format a disk, the volume letter is E:, for example, when they would like/expect it to be C:.  Don't worry, this is just the drive letter that Windows PE assigns to the volume.  When you apply an operating system image to this volume, OSD will ensure that the drive letter from the captured image is persisted in the new operating system.  The reasons for this behavior are summarized in the following KB articles:

http://support.microsoft.com/kb/218119

http://support.microsoft.com/kb/223769

If you need to refer to a drive letter created by a Partition and Format Disk step in a later step while still in Windows PE, you can save the drive letter that diskpart assigned to the volume in a task sequence variable on the Partition Properties page of the Format and Partition Disk step, using the Variable option under Advanced options.  You can enter a name for a variable to store the drive letter in, then use that variable to refer to the volume later in Windows PE.  Note that once you reboot, even back to Windows PE, the operating system will re-enumerate drive letters so this reference will no longer be valid.

 Note: It is technically possible to control the drive letters assigned by the new operating system by hacking the offline registry after the image has been applied, but this is risky (see above referenced KB articles) and the details of how to do this are beyond the scope of this blog.