How to automatically assign a drive letter by using the Diskpart.exe command on a Windows Server 2003-based computer or on a Windows XP-based computer

INTRODUCTION

This explains how to allocate a drive letter by using the Diskpart.exe command in the Sysprep.inf file and in the Cmdlines.txt file. The Diskpart.exe command can be used together with the Sysprep tool to deploy a Windows Server 2003-based or Windows
XP-based PC.

MORE INFORMATION

To allocate a drive letter, first form the DiskPart script, and then run the Sysprep tool by using any one of the following techniques.

DiskPart script sample

The following script (Script.txt) is used to allocate the drive letter of the second partition to drive X. This script thinks that you have divided the hard disk that attachés to PC into two partitions.
select disk 0
select partition 2
remove noerr
assign letter=X noerr

Method 1: Use mini-setup

1. make the distribution folder for the Sysprep tool in the following place:
C:\sysprep\i386\$OEM$
2. Add the given line to the "[Commands]" part of the Cmdlines.txt file to run the DiskPart script (Script.txt):
DISKPART /s C:\sysprep\OPTION\script.txt

3. Add the following line to the "[Unattended]" section of the Sysprep.inf file:
InstallFilesPath = C:\sysprep\i386
4. Copy the Cmdlines.txt file into the folder that you created in step 1.
5. Save the DiskPart script file in the following folder:
C:\sysprep\OPTION
6. Run the Sysprep.exe file by using the -mini switch.

Method 2: Use the Out of Box Experience (OOBE) Wizard

1. Add the following line to the "[GuiRunOnce]" section of the Unattend.txt file to run the DiskPart script:
DISKPART.EXE /s C:\sysprep\OPTION\script.txt
2. Save the DiskPart script file in the following place:
C:\sysprep\OPTION
3. Run the Sysprep.exe file.