How to Customize a WinPE Startup Process for Windows XP Deployments with the Diskpart Utility (303906)



The information in this article applies to:

  • Microsoft Windows XP 64-Bit Edition
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional

This article was previously published under Q303906

SUMMARY

This article describes how you can customize the Windows Preinstall Environment (WinPE) to perform customer-automated tasks at the startup of WinPE.

MORE INFORMATION

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.

Automating Diskpart

To automate a WinPE boot and a repartition with Diskpart, and to initiate an install of Windows XP:
  1. 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

  2. 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.txt
    echo Y | format c: /v:Syspart /fs:ntfs /q 
    echo Y | format d: /v:Sysdata /fs:ntfs /q 
    net use x: \\Server\XPShare
    X:\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.

  3. 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 1
    clean
    
    create partition primary size 4096
    assign letter c
    Active
    create partition extended 
    create partition logical
    assign letter d
    Exit
    					
    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.

Modification Type:MajorLast Reviewed:12/15/2003
Keywords:kbenv kbhowto kbsetup KB303906