Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Windows 11 / Create a Custom Windows Image with Pre-installed Apps

February 28, 2024

Create a Custom Windows Image with Pre-installed Apps

In this guide, we’ll cover how to create a custom Windows 10/11 installation image with pre-installed apps, necessary files, and other environment and application settings. Currently, many admins prefer to deploy a clean Windows image and then install all the required programs and tools on the computer: deploy software via GPO, using the installation commands in AutoUnattend.xml or in the %WINDIR%\Setup\Scripts\SetupComplete.cmd script (allow to install software during OOBE), GPO logon scripts. or using other automation tools (SCCM, Intune, MDT, Ansible). However, in some cases, business specifics require that a pre-built Windows image with all the necessary programs be deployed to end-user computers.

Contents:
  • Building a Reference Windows Image with Pre-installed Software
  • Capture a Custom Windows Image Using DISM
  • Replace the Original Install.wim Image File on the USB Flash Drive

The process of creating your custom Windows installation image with pre-installed software can include the following steps:

  1. Deploy a clean Windows instance on a reference computer (virtual machine);
  2. Boot Windows in audit mode, install the apps, configure the environment;
  3. Boot the device into the WinPE environment and capture the WIM image of the installed Windows using DISM;
  4. Replace the original install.wim on the installation USB flash drive (ISO image).
If you are deploying Windows to computers on a corporate network, it is more convenient to use MDT, which allows you to add/update programs during the installation process without having to modify the installation WIM image each time.

Building a Reference Windows Image with Pre-installed Software

The first step is to create a reference image of Windows with all the programs, files, and settings you need. Perform a clean Windows installation on a virtual machine or computer.

Download the original Windows 10/11 installation image as an ISO file or burn it directly to a bootable USB flash drive using the Media Creation Tool or Rufus.

Perform a manual Windows installation and press CTRL+SHIFT+F3 at the OOBE stage (when prompted to select regional settings). This will put the computer into Audit Mode, and you will be automatically logged in as the built-in Administrator account.

Sysprep Audit Mode (Ctrl + Shift + F3)

When the desktop appears, minimize the Sysprep window (don’t close it!!). Then you can start installing programs and updates, and configuring the necessary Windows settings.

I will use the WinGet package manager to install various apps and tools on Windows:

winget install --id=7zip.7zip -e ; winget install --id=Notepad++.Notepad++ -e ; winget install --id=VideoLAN.VLC -e ; winget install --id=WinDirStat.WinDirStat -e ; winget install --id=dotPDNLLC.paintdotnet -e ; winget install --id=IrfanSkiljan.IrfanView -e ; winget install --id=Microsoft.PowerToys -e

Installing software on Windows using the Winget tool

I also manually created directories and copied files for several business apps.

Customize reference Windows image

Customize desktop shortcuts, Start menu tiles, wallpapers, screensavers, color schemes, and more. Configure local Group Policy settings using the gpedit.msc editor. These settings will be applied to all computers that you deploy from this custom Windows image.

Once you have set up the operating system and applications, you must clean up Windows to reduce the final image size.

Delete existing shadow copies and restore points:

vssadmin delete shadows /All /Quiet

Clean up unused components and update files in the WinSxS folder:

Dism.exe /Online /Cleanup-Image /StartComponentCleanup /ResetBase

Remove the Windows Update cache files:

del %windir%\SoftwareDistribution\Download\*.* /f /s /q

You can use this PowerShell script to clean up the Temp, Downloads, and Cache folders in the user profile.

Perform a disk cleanup using the cleanmgr tool:

Cleanmgr /sagerun:1

Clear Event Viewer logs:

for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"

Empty the Recycle Bin in Windows:

Clear-RecycleBin -Force

To apply the current user’s settings to the Default user (used as a template when creating new Windows users), create an unattend.xml answer file in the C:\Windows\System32\Sysprep directory.

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CopyProfile>true</CopyProfile>
</component>
</settings>
</unattend>

The final step is to prepare your custom Windows image for deployment with the sysprep.exe tool. Expand the Sysprep window and select the following options:

  • Enter System Out-of-Box Experience (OOBE)
  • Generalize
  • Shutdown

Sysprep: prepare image for deployment

When this process is complete, the computer will automatically shut down.

Capture a Custom Windows Image Using DISM

At this stage, you will need to capture an offline Windows image from a local drive, save it as a WIM file, and place it on a separate drive (we connected a separate 60GB empty drive to the computer).

Boot the computer with the referenced Windows image into the WinPE environment (WinRE). Using the Windows installation USB stick, boot the computer and press Shift+F10 to open the command prompt.

Identify the drive letters assigned to the Windows partition and the empty drive to which the WIM file will be copied. Run the command:

diskpart
list disk
exit

check drive letter assigned

In this example, the drive containing Windows is assigned the letter E: and the empty drive is D:.

To capture an offline Windows image from the E drive and save the resulting WIM image to the D drive, run the command:

dism /capture-image /imagefile:D:\install.wim /capturedir:E:\ /ScratchDir:D:\ /name:"MyWinImage" /compress:maximum /checkintegrity /verify /bootable

It took about 30 minutes to capture the image in my case.
Capture Windows image with DISM

Replace the Original Install.wim Image File on the USB Flash Drive

Once you have captured your customized Windows image, you can replace the original install.wim or install.esd image file in the \sources folder on the installation USB flash drive (ESD is the maximum compression format used for WIM).

In my case, I renamed the old image file to install.esd_bak and copied the new install.wim image to the USB stick.

replace the original install.wim file with a custom wim image

Note that the WIM image size with pre-installed software has increased significantly (from 4GB to 10GB).

If you have a FAT32 bootable USB key for installing Windows on UEFI computers, you cannot save a WIM file larger than 4GB on this file system. A large WIM image file must be split into several smaller SWM files in this case:

Dism /Split-Image /ImageFile:D:\sources\install.wim /SWMFile:c:\tmp\install.swm /FileSize:3500

In this case, DISM will create four files install.swm, install2.swm, install3.swm, and install4.swm. Copy these files to the \sources folder on the installation media. When Windows Setup installs the operating system, it merges the SWM files.

Now you can use your bootable USB flash drive to deploy the Windows image you created to any computer (you can also install Windows over the network using PXE boot).

Check that all preinstalled apps are available after Windows installation is complete:

Get-Package

Deploy custom Windows image with preinstalled software

The downside of this method of deploying a preconfigured Windows image is that you have to rebuild the image to update any of the apps it contains.

Windows Updates and drivers can be integrated directly into the WIM image. In this case, there is no need to go through the full deployment and image capture cycle.
5 comments
15
Facebook Twitter Google + Pinterest
Windows 10Windows 11
previous post
Find a Linux Process Listening on a Specific Port
next post
Adding ESXi Host to VMware vCenter Server (vCSA)

Related Reading

How to Allow Multiple RDP Sessions on Windows...

March 15, 2024

How to Run Program without Admin Privileges and...

June 8, 2023

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

Managing Windows Firewall Rules with PowerShell

March 11, 2024

How to Fix ‘An Operating System Wasn’t Found’...

August 24, 2023

How to Allow Non-Admin User to Start/Stop Service...

March 15, 2024

Updating PowerShell Version on Windows

March 12, 2024

Fixing ‘The Network Path Was Not Found’ 0x80070035...

August 31, 2023

5 comments

AllonZ February 29, 2024 - 10:58 pm

Thanks for the awesome tutorial!

It has given me great insight on how to prep my custom ISO since I have not had great success with other methods.

I do have a few questions that I hope don’t mind answering. It could save me much time and aggravation.

I do not have a “reference computer” or any experience with virtual machines. Can Hyper-V Manager accomplish the task in the article?

If not, is there a free virtual machine service, like Oracle VM VirtualBox or VMware Workstation Player, that can do this and use the hardware drivers from the host machine?

Thanks again!

Reply
Kiril July 10, 2024 - 11:31 am

Thank you for tutorial!
I did everything from it.
Tried to install the image, get to the point I need to enter license key and after entering right key (from the label on the bottom of the laptop) I get an error message saying: “The product key entered does not match any of the windows images available for installation. Enter a different product key”
I’m using Win11 Pro OEM version
Tried to create PID.txt file with: [PID] Value=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx, with license key itself – doesn’t work.
Tried to create ei.cfg file and write in it: [Channel] Retail
[VL] 0
doesn’t work.

Would appreciate help

Reply
Francesco September 2, 2024 - 10:20 am

Is it mandatory to customize the image in audit mode? In other words, what isntead if I setup everything when the physical pc boots up the first time and then once finished I run the sysprep /oobe /generalize /shutdown ? Thanks.

Reply
admin September 3, 2024 - 12:32 pm

In the audit mode, the default user profile settings are updated. These settings are then applied to all new users. Also, this allows to remove user-specific information from the user profile.
If audit mode is not used, the user setting in the profile will be lost during OS deployment.

Reply
AtariBaby September 10, 2024 - 7:54 pm

Advice here:
*The best disk part command is “list volume”. For me anyway list disk does not show drive letters.
*I had to remove “client web experience” and “widgets platform runtime” to finish sysprep. Also had to remove notepad++ that I had installed from winget.
*i found one of the commands didn’t work: “ del %windir%\SoftwareDistribution\Download\*.* /f /s /q” i had to find an updated command for this but now i can’t remember what it was sorry!

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Encrypt Any Client-Server App Traffic on Windows with Stunnel

    June 12, 2025
  • Failed to Open the Group Policy Object on a Computer

    June 2, 2025
  • Remote Desktop Printing with RD Easy Print Redirection

    June 2, 2025
  • Disable the Lock Screen Widgets in Windows 11

    May 26, 2025
  • Configuring Windows Protected Print Mode (WPP)

    May 19, 2025
  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Allow Multiple RDP Sessions on Windows 10 and 11
  • How to Run Program without Admin Privileges and Bypass UAC Prompt
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows
  • Fixing ‘The Network Path Was Not Found’ 0x80070035 Error Code on Windows
  • How to Delete Old User Profiles in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • How to Backup and Copy Local Group Policy Settings to Another Computer
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top