This article was previously published under Q303906
This article has been archived. It is offered "as is" and will no longer be updated.
This article describes how you can customize the Windows Preinstall Environment (WinPE) to perform customer-automated tasks at the startup of WinPE.
In WinPE, you can use the Diskpart.exe utility to manually process the cleaning of an entire hard disk (or hard disks), or the deletion or creation of new partitions prior to initiating an install of Windows XP.
To automate a WinPE boot and a repartition with Diskpart, and to initiate an install of Windows XP:
Edit the Startnet.cmd file in the I386\System32 folder of the WinPE source files and add a Formatbat.cmd entry to the end of the file.
NOTE: This step is performed when the WinPE source files have been copied from the CD-ROM to a Flat folder for customization.For example:
regsvr32 /s netcfgx.dll factory -minint netcfg -v -winpe net start dhcp net start nla a:\floppy.cmd formatbat.cmd
Create a file called Formatbat.cmd and place it in the I386\System32 WinPE source folder with the following text (this step calls the Diskpart script to create two partitions in this example, and then formats them and initiates Windows XP Setup):
diskpart /s delpart.txtecho Y | format c: /v:Syspart /fs:ntfs /q echo Y | format d: /v:Sysdata /fs:ntfs /q net use x: \\Server\XPShareX:\XPPro\i386\winnt32.exe /syspart:c: /unattend:X:\XPPro\unattend.txt /s:X:\XPPro\i386"exit
NOTE: You must use the parameter /syspart:c: for Setup to start successfully.
Create a file called Delpart.txt and place it in the I386\System32 WinPE source folder with the following text. This step creates the partitions, a primary partition that uses 4,096 megabytes (MB) of disk space; assigns a drive letter (C:) and marks it as "active", creates an extended and logical partition by using the remaining space on disk 1 and assigns the drive letter (D:), and then exits back to enable the next command in the Formatbat.cmd file to process or proceed with formatting both of these partitions as NTFS as well as initiate an unattended install of Windows XP from a network share:
Select disk 1cleancreate partition primary size 4096assign letter cActivecreate partition extended create partition logicalassign letter dExit
The preceding step can be made to initiate an "unattended sysprep factory install" when the partitions are created: The primary partition is marked active or assigned drive letters and formatted.
Typically, when these files are configured, the WinPE source files are used to create a startup CD-ROM.