天天看點

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

原料: WimTool, UltraISO, Winpe.iso

Step:

1. 用UltraISO打開Winpe.iso, 将/source/BOOT.wim提取出來:

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

2. 以管理者身份打開/WimTool/WimTool.EXE,選擇要挂載的映像檔案:1>剛才導出的BOOT.wim;2>建立一個空檔案夾為目标檔案夾;3>點“解開映像”

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

3. 大約1分鐘後,提示解開成功。打開解壓後的檔案夾(如果檔案夾内部為空,請确認是以管理者運作的WimTool.exe),進到檔案夾中的Windows/System32,找到 startnet.cmd

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

4. 編輯startnet.cmd,在wpeinit後另起一行輸入要執行的檔案名,由于不能确定存放目錄,這裡加了幾行屁處理來檢查。這樣後續隻要把要執行的檔案寫到task.bat裡面放到根目錄下即可。為顯示自己為小白沒有用for循環:

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

4. 儲存編輯過的startnet.cmd.然後用WimTool生成新的BOOT.wim

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

5. 将生成的BOOT.wim寫回 Winpe.iso

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

7. 在UltraISO,儲存鏡像. 并且把要啟動的檔案放到根目錄下。刻錄到CD光牒,或者選擇Bootable - Write Disk Image...刻錄到U盤。

WinPE的制作 - 進WinPE後自動運作程式WinPE: Mount and Customize

8. 應該就OK了。

附上官方的資料供參考:



WinPE: Mount and Customize

Updated: December 9, 2013

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

Add drivers to Windows PE, such as graphics drivers or network drivers.

Common customizations:

  • Add device drivers (.inf files). You can customize device drivers, such as drivers that support network cards or storage devices. For more info, seeWinPE: Add drivers.
  • Add optional components (packages or .cab files). You can add features to Windows PE, such as languages, hotfixes, and support for features like PowerShell and the HTML Application Language (HTA). In Windows PE, feature packages are known as optional components. For more info, seeWinPE: Add packages (Optional Components Reference).
  • Add a language. To run Windows PE in multiple languages, add the packages (optional components) for those languages. For more info, seeWinPE: Add packages (Optional Components Reference).
  • Add a startup script. Examples include setting up a network connection, or adding a custom application, such as diagnostic software.
  • Add an app. Note, Windows PE only supports legacy apps.
  • Add temporary storage (scratch space). If your application requires temporary file storage, you can reserve extra memory space in RAM.
  • Replace the background image
  • Add answer file settings

Get the Windows Assessment and Deployment Kit with Windows PE tools

  • Install the Windows Assessment and Deployment Kit (Windows ADK) Technical Reference, including the Windows PE feature.

Create a set of either 32-bit or 64-bit Windows PE files

  • Click Start, and type deployment. Right-clickDeployment and Imaging Tools Environment and then selectRun as administrator.
  • In the Deployment Tools and Imaging Environment, copy the Windows PE files for the PCs you want to boot.
    • The 64-bit version can boot 64-bit UEFI and 64-bit BIOS PCs.

      Copy

      copype amd64 C:\WinPE_amd64
            
    • The 32-bit version of Windows PE can boot 32-bit UEFI, 32-bit BIOS, and 64-bit BIOS PCs.

      Copy

      copype x86 C:\WinPE_x86
            

Mount the Windows PE boot image

  • Mount the Windows PE image.

    Copy

    Dism /Mount-Image /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE_amd64\mount"
          

Add customizations

Add a startup script

  1. Modify the Startnet.cmd script to include your customized commands. This file is located at

    C:\WinPE_amd64\mount\Windows\System32\Startnet.cmd

    .

    You can also call other batch files or command line scripts from this file.

    For Plug and Play or networking support, make sure that you include a call to wpeinit in your customized Startnet.cmd script. For more info, see Wpeinit and Startnet.cmd: Using WinPE Startup Scripts.

Add an app

  1. Create an app directory inside the mounted Windows PE image.

    Copy

    md "C:\WinPE_amd64\mount\windows\<MyApp>"
          
  2. Copy the necessary app files to the local Windows PE directory.

    Copy

    Xcopy C:\<MyApp> "C:\WinPE_amd64\mount\windows\<MyApp>"
          
  3. Test the app later by booting Windows PE and running the application from the X: directory.

    Copy

    X:\Windows\System32> X:\Windows\<MyApp>
          
    If your app requires temporary storage, or if Windows PE becomes unresponsive when it runs an app, you may need to increase the amount of temporary storage (scratch space) allocated to Windows PE.
  4. To automatically launch a shell or application that runs when Windows PE starts, add the path location to the Winpeshl.ini file. For more info, seeWinpeshl.ini Reference: Launching an app when WinPE starts.

Add temporary storage (scratch space)

  1. Windows PE reserves memory on the X: drive to unpack the Windows PE files, plus additional temporary file storage, known as scratch space, that can be used by your applications. By default, this is 512MB for PCs with more than 1GB of RAM, otherwise the default is 32MB. Valid values are 32, 64, 128, 256, or 512:

    Copy

    Dism /Set-ScratchSpace:128 /Image:"C:\WinPE_amd64\mount"
          

Replace the background image

  1. If you've got multiple versions of Windows PE, you can set the background image so you can instantly tell which version of Windows PE is running.

    Change the security permissions of the Windows PE background image file (

    \windows\system32\winpe.jpg

    ). This allows you to modify or delete the file.
    1. In Windows Explorer, navigate to

      C:\WinPE_amd64\mount\windows\system32

      .
    2. Right-click the

      C:\WinPE_amd64\mount\windows\system32\winpe.jpg

      file, and selectProperties >Security tab > Advanced.
    3. Next to Owner, select Change. Change the owner to Administrators.
    4. Apply the changes, and exit the Properties window to save changes.
    5. Right-click the

      C:\WinPE_amd64\mount\windows\system32\winpe.jpg

      file, and selectProperties >Security tab > Advanced.
    6. Modify the permissions for Administrators to allow full access.
    7. Apply the changes, and exit the Properties window to save changes.
  2. Replace the

    winpe.jpg

    file with your own image file.

Add answer file settings

  • Some Windows PE settings can be managed by using an answer file, such as firewall, network, and display settings. Create an answer file, name it unattend.xml, and add it to the root of the Windows PE media to process these settings. For more information, see Wpeinit and Startnet.cmd: Using WinPE Startup Scripts.

Unmount the Windows PE image and create media

  1. Unmount the Windows PE image.

    Copy

    Dism /Unmount-Image /MountDir:"C:\WinPE_amd64\mount" /commit
          
  2. Create bootable media, such as a USB flash drive.

    Copy

    MakeWinPEMedia /UFD C:\WinPE_amd64 F:
          
  3. Boot the media. Windows PE starts automatically. After the Windows PE window appears, the wpeinit command runs automatically. This may take a few minutes. Verify your customizations.

Troubleshooting

  • Windows PE won’t boot? See the troubleshooting tips at the end of the topic: WinPE: Create USB Bootable drive
  • For tips on connecting to a network, see WinPE Network Drivers: Initializing and adding drivers.
  • If the Windows PE image becomes unserviceable, you may need to clean up the images before you can mount the image again. For information, seeRepair a Windows Image.

To delete a working directory:

In some cases, you may not be able to recover the mounted image. DISM protects you from accidentally deleting the working directory, so you may have to try the following steps to get access to delete the mounted directory. Try each of the following steps:

  1. Try remounting the image:

    Copy

    dism /Remount-Image /MountDir:C:\mount
          
  2. Try unmounting the image, discarding the changes:

    Copy

    dism /Unmount-Image /MountDir:C:\mount /discard
          
  3. Try cleaning up the resources associated with the mounted image:

    Copy

    dism /Cleanup-Mountpoints
          

See Also

Tasks

WinPE: Create USB Bootable drive

WinPE: Create a Boot CD, DVD, ISO, or VHD

WinPE: Install on a Hard Drive (Flat Boot or Non-RAM)

WinPE: Boot in UEFI or legacy BIOS mode

Concepts

WinPE: Add packages (Optional Components Reference)

Other Resources

WinPE for Windows 8.1: Windows PE 5.1