0

I want to use an existing WinPE.wim to troubleshoot problems and run Windows' install's setup.exe, with a desktop shortcut linking to it.

  1. Is this as simple as adding a desktop shortcut to folders containing the setup/install file?
  2. Where can I find information on modifying a WinPE.wim and rebuilding it?
JW0914
  • 7,052
  • 7
  • 27
  • 48
SteveF
  • 13
  • 1
  • 3
  • Questions seeking product, service, or **learning material recommendations** are off-topic because they become outdated quickly and attract opinion-based answers. – Ramhound Mar 01 '21 at 13:23
  • @Ramhound None of those apply to WinPE _(see previous comment)_. – JW0914 Mar 01 '21 at 13:24
  • **"What are the best application/s to work with"** and **"Best link or tutorial for newbies"** are both out of scope. If you feel you can answer the question, then you can do exactly that, I don't believe this question is a good fit for our community due to those specific questions. – Ramhound Mar 01 '21 at 13:25
  • @JW0914 - Sounds like you can answer the author's question. – Ramhound Mar 01 '21 at 13:29
  • 1
    You'll need to install the Windows ADK & WinPE addon, mount the `winpe.wim` via `DISM`, then add the WinPE OCs [Optional Components] you want, commit the changes to the WIM, then export it to a new WIM file for storage efficiency. Refer to [Microsoft Docs](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-intro) and the sub-topics under WinPE, as this is the only way to do so _(you can also use [WinPESE](http://win10se.cwcodes.net/))_, and I'll write an in-depth answer over the weekend. – JW0914 Mar 02 '21 at 13:21

2 Answers2

2

Is this as simple as adding a desktop shortcut to folders containing the setup/install file?

No, as WinPE is a self-contained boot WIM [Windows IMage] containing WinPE OCs [Optional Components]:

  • WinPE-Setup is required for Windows Setup, which has seven configuration passes:
    • Upon selecting Install: windowsPE
    • Setup boots to WinPE: offlineServicing
    • Setup boots to Windows: specialize, auditSystem, auditUser, oobeSystem

Where can I find information on modifying a WinPE.wim and rebuilding it?

Microsoft Docs, with two routes for customizing a WinPE.wim/WinRE.wim:

  • Build your own:
    • Recommended over customizing an existing custom WIM, as it's more storage efficient and doesn't add a significant amount of time to customization

  • Create one using WinPESE, which creates a normal Windows GUI within WinPE:
    • Cons: the WinPE.wim/WinRE.wim balloons from ~320MB to ~1.5GB+ and the larger the WIM, the longer it takes to boot it, as all data within the WIM has to be mounted [extracted] to a virtual partition [X:]
    • Pros: Offers a whole host of advanced troubleshooting tools and, if regularly capturing WIMs of the C: partition, allows for basic work to still be done while booted to WinPE


PreReqs:

  1. Install Windows ADK and WinPE files:
    1. ADK (Win7: AIK) for the version of Windows installed
      (Setup: Windows Preinstallation Environment)
    2. ≥ v1809: Windows PE Add-On is separate (ADK still required)

  2. Update the system PATH: WinKey+RSysDm.cplOK
    1. AdvancedEnvironment Variables...System variablesPathEditNew:
      # Update paths accordingly if not using Win10 or an x64 OS version:
        C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools
        C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\BCDBoot
        C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM
        C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg
        C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment
      
    2. OKOKOK

  3. Open an Admin terminal: WinKey+RpowershellCtrl+Shift+OK


Build WinPE Filesystem

  1. Required:

    1. Mount WinPE boot image:
      # Load ADK variables:
        Cmd /K "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"
      
      # Copy WinPE files to working directory C:\WinPE:
        CopyPE amd64 "C:\WinPE"
      
      # Mount WinPE WIM:
        Dism /Mount-Image /ImageFile:"C:\WinPE\media\sources\boot.wim" /Index:1 /MountDir:"C:\WinPE\mount"
      
    2. Add WinPE Optional Components:
      # Create OCs directory link in working directory C:\WinPE:
        MkLink /J "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs" "C:\WinPE\OCs"
      
      # Add OCs: (OC and language CABs required for each OC)
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\<name>.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\<name>_en-us.cab"
      
      The following are the minimum I recommend:
      (dependencies exist, add in the order listed)
      • PreReqs:
        WinPE-WMI.cab, WinPE-NetFx.cab, WinPE-Scripting.cab
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-WMI.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-WMI.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-NetFx.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-NetFx.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-Scripting.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-Scripting.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-EnhancedStorage.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-EnhancedStorage.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-FMAPI.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-FMAPI_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-SecureStartup.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-SecureStartup_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\WinPE-Dot3Svc.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\WinPE-Dot3Svc.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-pppoe.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-pppoe_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-rndis.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-rndis.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-wds-tools.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-wds-tools.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-wifi-package.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-wifi-package.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-powershell.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-powershell.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-dismcmdlets.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-dismcmdlets.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-platformid.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-platformid_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-securebootcmdlets.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-securebootcmdlets.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-storagewmi.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-storagewmi_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-rejuv.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-rejuv.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-srt.cab.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-srt.cab_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-winrecfg.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-winrecfg_en-us.cab"
        
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\winpe-setup.cab"
        Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\OCs\en-us\winpe-setup_en-us.cab"
        
    3. Set WinPE default temp space to 512MB: (default: 32MB)
      Dism /Set-ScratchSpace:512 /Image:"C:\WinPE\mount"
      


  1. Optional - Add custom:
    1. Drivers: (Network drivers)
      Dism /Add-Driver /Image:"C:\WinPE\mount" /Driver:"C:\Path\to\driver.inf"
      
    2. Files/directories: Copy to C:\WinPE\mount
      • QDir Portable provides an Explorer-like GUI with advanced functionality and is highly customizable via its Q-Dir.ini
      • Enable to view hidden files in WinPE's SYSTEM Registry hive:
        # Load WinPE SYSTEM hive:
          Reg Load HKLM\WinPE "C:\WinPE\mount\Windows\System32\config\SYSTEM"
        
        # Show hidden files:
          Reg Add HKLM\WinPE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 1
          Reg Add HKLM\WinPE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 1
        
        # Show file extensions:
          Reg Add HKLM\WinPE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 0
        
        # Unload Hive:
          Reg Unload HKLM\WinPE
        
    3. Startup scripts to: C:\WinPE\mount\Windows\System32\Startnet.cmd
    4. Startup apps (such as QDir) to: C:\WinPE\mount\Windows\System32\Winpeshl.ini
    5. Background:
      1. Change permissions of C:\WinPE\mount\Windows\System32\winpe.jpg:
        # Change ownership to the Administrators group:
          TakeOwn /A /F "C:\WinPE\mount\Windows\System32\winpe.jpg"
        
        # Give Administrators group Full permissions:
          Icacls "C:\WinPE\mount\Windows\System32\winpe.jpg" /SetOwner Administrators
        
      2. Replace winpe.jpg with a custom .jpg
    6. Power Scheme: set to Performance by adding to C:\WinPE\mount\Windows\System32\startnet.cmd:
      powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
      


  1. If needed, apply any .msu updates to WinPE from the Microsoft Update Catalog:
    # Add update package:
      Dism /Add-Package /Image:"C:\WinPE\mount" /PackagePath:"C:\WinPE\windows10.0-kbxxxxx.msu"
    
    # Lock in the update:
      Dism /Cleanup-Image /Image:"C:\WinPE\mount\Windows" /StartComponentCleanup /ResetBase
    

  2. Commit changes, unmount, and export image:
    # Optimize:
      Dism /Cleanup-Image /Image:"C:\WinPE\mount" /StartComponentCleanup /ResetBase
    
    # Unmount:
      Dism /Unmount-Image /MountDir:"C:\WinPE\mount" /Commit
    
    # Export:
      Dism /Export-Image /SourceImageFile:"C:\WinPE\media\sources\boot.wim" /SourceIndex:1 /DestinationImageFile:"C:\WinPE\WinPE_Custom.wim" /DestinationName:"Customized WinPE & Includes: QDir, Show Hidden Files" /Compress:Max /Bootable /CheckIntegrity
    
    # Replace original:
      Del "C:\WinPE\media\sources\boot.wim"
      Copy "C:\WinPE\WinPE_Custom.wim" "C:\WinPE\media\sources\boot.wim"
    

  3. Create WinPE boot media via MakeWinPEMedia:
    • ISO: (via OsCdImg)
      MakeWinPEMedia /Iso "C:\WinPE" "C:\WinPE\WinPE.iso"
      
    • USB:
      MakeWinPEMedia /Ufd "C:\WinPE" F:
      
    • WinRE Replacement:
      Required: WinPE-Rejuv & WinPE-SRT
      1. Mount WinRE partition:
        DiskPartLis VolSel Vol #Assign Letter=ZExit
      2. Configure WinRE: [ReAgentC]
        # Disable WinRE:
          ReAgentC /Disable
        
        # Copy modified WinPE WIM to Recovery partition:
          Del "Z:\Recovery\WindowsRE\WinRE.wim"
          Copy "C:\WinPE\media\sources\boot.wim" "Z:\Recovery\WindowsRE\WinRE.wim"
        
        # Set WinRE Path:
          ReAgentC /SetREimage /Path "Z:\Recovery\WindowsRE"
        
        # Enable WinRE:
          ReAgentC /Enable
        
        # Verify:
          ReAgentC /Info
        
      3. Unmount WinRE partition: DiskPartSel Vol ZRemoveExit
JW0914
  • 7,052
  • 7
  • 27
  • 48
0

I would suggest the following:

The USB disk must be large enough to hold the To Go environment and the Windows ISO.

I cannot guarantee that this method will work, as I never tried it.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • @harrymc...thank you for responding but what I really need is the already existing troubleshooting WinPE. I just want to be able to add the ability to also install Windows from it. – SteveF Mar 01 '21 at 18:37
  • There are methods to copy WinPE to the hard disk and even make it bootable. But do you really want to have WinPE installed on your computer instead of the full Windows? It's rather limited. Note: I found other sources with variants of this method, so it must be working. The USB must be formatted as NTFS, since the ISO is too large for FAT32. – harrymc Mar 01 '21 at 19:19
  • @harrymc...I'm not looking for Windows To Go but the ability to modify an existing WinPE troubleshooting disk. I want to be able to install Windows from it – SteveF Mar 01 '21 at 19:49
  • You modify an existing WinPE USB to install Windows from it by simply copying the Windows installation ISO into it. You install Windows from this ISO. This does exactly what you want. Windows To Go is a kind of WinPE as far as you're concerned. – harrymc Mar 01 '21 at 19:55
  • @harrymc Since you have the rep to see what I can not, what admin deleted my comment under the OP's question that provided the steps to do so? Windows has a bootable WinPE WIM pre-installed - WinRE [Windows Recovery] - stored at `\\\Recovery\WindowsRE\WinRE.wim` _(WinRE is WinPE with a minimum of two recovery-specific WinPE [Optional Components](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-add-packages--optional-components-reference) added to it [`Recovery/WinPE-Rejuv` & `Recovery/WinPE-SRT`])_. The OC to add Windows Setup is `Setup/WinPE-Setup`. – JW0914 Mar 02 '21 at 07:28
  • @JW0914: Sorry, reputation is not enough for that. I'm not sure that even a moderator would be able to see that. But why don't you add an answer with this information? – harrymc Mar 02 '21 at 08:48
  • @harrymc I plan on doing so over the weekend, but due to the complexity of the steps, I don't currently have the time it's going to take to write and format an in-depth answer – JW0914 Mar 02 '21 at 13:17