Microsoft KB Archive/928543

= 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 =

Article ID: 928543

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Windows Server 2003, Standard Edition (32-bit x86)
 * Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
 * Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional
 * Microsoft Windows XP Media Center Edition 2002
 * Microsoft Windows XP Tablet PC Edition

-



INTRODUCTION
This article describes how to automatically assign 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 Microsoft Windows Server 2003-based computer or a Microsoft Windows XP-based computer.



MORE INFORMATION
To automatically assign a drive letter, first create the DiskPart script, and then run the Sysprep tool by using one of the following methods.

DiskPart script sample
The following script (Script.txt) is used to assign the drive letter of the second partition to drive X. This script assumes that you have divided the hard disk that connects to the computer into two partitions. select disk 0 select partition 2 remove noerr assign letter=X noerr

Method 1: Use mini-setup
 Create the distribution folder for the Sysprep tool in the following location:

C:\sysprep\i386\$OEM$

 Add the following line to the &quot;[Commands]&quot; section of the Cmdlines.txt file to run the DiskPart script (Script.txt):

DISKPART /s C:\sysprep\OPTION\script.txt

 Add the following line to the &quot;[Unattended]&quot; section of the Sysprep.inf file:

InstallFilesPath = C:\sysprep\i386

 Copy the Cmdlines.txt file into the folder that you created in step 1. Save the DiskPart script file in the following folder:

C:\sysprep\OPTION

 Run the Sysprep.exe file by using the -mini switch. For more information about the general methods of Windows deployment when you use the Sysprep tool, click the following article number to view the article in the Microsoft Knowledge Base:

302577 How to use the Sysprep tool to automate successful deployment of Windows XP



Method 2: Use the Out of Box Experience (OOBE) Wizard
Note The OOBE Wizard is available only in Windows XP.  Add the following line to the &quot;[GuiRunOnce]&quot; section of the Unattend.txt file to run the DiskPart script:

DISKPART.EXE /s C:\sysprep\OPTION\script.txt

</li> Save the DiskPart script file in the following location:

C:\sysprep\OPTION

</li> Run the Sysprep.exe file. For more information about the general methods of Windows deployment when you use the Sysprep tool, click the following article number to view the article in the Microsoft Knowledge Base:

302577 How to use the Sysprep tool to automate successful deployment of Windows XP

</li></ol>

<div class="references_section">