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4i|p1|ng|yj|ki|ol|us|cq|ru|ds|yb|mr|ex|jy|u3|og|k3|yh|cw|xy|8r|5i|ml|ca|bo|bt|bt|by|bc|20|ug|7q|0r|ah|qu|ls|ri|bv|ox|gz|yh|0v|ek|sl|np|wf|mg|vg|kz|7r|m8|mw|aw|6e|kh|sz|wj|z4|gx|l7|1s|sj|3i|wc|fo|l3|fx|fl|63|nv|mp|mx|dp|ad|ow|75|4f|jv|2v|ob|ej|uz|ox|qh|hl|zj|pj|ay|jw|n2|74|0n|ag|lc|zu|cv|sd|mv|20|gw|6n|zf|js|0l|e5|zm|40|rb|na|na|uq|ah|6q|ab|hr|cy|2y|yc|hi|4s|1a|u4|hs|fm|re|ga|nz|82|e3|hk|3r|bt|1i|oo|ut|vl|oi|jk|oc|oz|o2|om|o9|jx|lz|6a|0j|wm|en|1 Windows 10 Unattended install media – Part 4: Customize Windows Image – Win10.Guru
Go to ...

RSS Feed

Windows 10 Unattended install media – Part 4: Customize Windows Image


With the answer files complete, now it’s time to install Windows 10 on a reference Hyper-V virtual machine. You can naturally use any other virtualization platform for this, or even a spare physical PC, but I prefer Hyper-V and recommend it highly. To get started with Hyper-V in case you are not familiar with this platform, see my Hyper-V tutorial on TenForums.com

Create and configure VM

Create a new VM. The VM generation can be whatever you’d prefer, Generation 1 or Generation 2. In the New Virtual Machine Wizard, assign enough RAM (2 GB minimum) and disable (unselect) dynamic memory. For the next step leave the connection status as Not connected for now.  We will do our Windows Setup without a network connection and will  instead connect later:

Accept the default 127 GB virtual hard disk size, and in the next step select ISO as the install media, then browse to and select your preferred Windows 10 ISO image:

Finish the wizard. Before starting the VM up, right-click it in Hyper-V Manager and select Settings. Increase the number of virtual processors, two will be enough in most cases, and disable (unselect) automatic checkpoints. Click OK to save your settings:

Install Windows

Start the VM, and install Windows normally. This VM will have quite a short life span, so it does not have to be activated. When Windows Setup asks for a product key, select I don’t have a product key and continue on with setup:

When OOBE starts and the region and language selection screen is shown, press and hold down both the CTRL and SHIFT keys, press the F3 key, then release all keys. This  causes Windows to restart and boot into the so-called Audit Mode (a special customization mode for Windows):

Prepare assets

Windows installation on our reference VM will take 10 minutes or more even on a relatively fast host (host = PC used to run Hyper-V or other virtual machines). On the laptop I am using at the moment, it takes about 20 minutes. This gives us time to prepare and collect assets such as software installers, wallpapers, additional files and so on.

Create a new folder on any network share you have at your disposal. Name it Assets (or whatever you like). In case you don’t have any network shares on your host, create a new folder anywhere, name it Assets and share it. Right click that new folder, select Properties, select the Sharing tab, click on Advanced sharing, select Share this folder, name it as you like, click OK to save it, and then click Close to close the folder properties window:

Nowadays, the first asset I always copy to the Assets folder is the OneDrive standalone installer (get it here). There’s a known bug in Windows 10 since version 1703 that renders OneDrive unable to run after Windows has been sysprepped. Thus, it needs to be reinstalled. When I start customizing Windows on any reference VM, I will uninstall OneDrive first and foremost. The, I set this offline installer to run automatically when the first user signs in after Windows has been installed from my custom ISO.

It’s up to you: if your users don’t need OneDrive, you don’t need to reinstall it. Personally, I can no longer even think how to cope without my several terabytes of OneDrive storage on multiple accounts. For me, therefore, the OneDrive standalone installer is the first asset to copy into the Assets folder.

There’s another minor bug in Sysprep. Since Anniversary Update version 1607, when Windows image gets sysprepped,  end users see the built-in admin’s folders in File Explorer’s Quick Access. Ditto for the built-in admin’s recent files (everything we work with when customizing a Windows image). Fortunately, there’s an easy fix. On the host machine, open Notepad and copy these two lines into a new file:

echo Y | del %appdata%\microsoft\windows\recent\automaticdestinations\*
del %0

Save this file as RunOnce.bat in the Assets folder. We will later add this file to our Default Profile (the base profile Windows uses for each new user profile). The first line resets Quick Access and Recent Files to Windows defaults when a new user signs in for the first time. The second line then deletes the batch file itself from this specific user to ensure that it will only be run the first time a new user signs in.

Next come the Windows theme files. Windows won’t get activated as we start customizing in Audit Mode. Thus, this disables all personalization options using the Settings app. However, there’s nothing to prevent applying an imported a so-called Windows Desktop Theme Pack file with long extension .deskthemepack. On your host, create themes as you wish (wallpapers, colors and so on), then right click the theme in Settings > Personalization > Themes and select Save for sharing, saving them to the Assets folder:

The unattend.xml answer file to automate OOBE we created in Part 3 of this series must go into the Assets folder, too. Also, if you have prepared an OEM logo image (120*120 bitmap), and you added an OEM logo location into unattend.xml answer file in Part 3, copy that oemlogo.bmp file now into the Assets folder.

The rest is up to you. You can download and install software directly onto the reference virtual machine when we start customizing. If you’d prefer using offline and standalone installers, you can download them onto the host while Windows is still installing on reference VM and copy them into the Assets folder. In addition, if you want user profile folders to contain any documents, images, videos and such when a new user account is created, copy all this stuff into the Assets folder, too.

In the following screenshot my sample Assets folder contains the all-important unattend.xml answer file (the key to everything), my OEM logo image and RunOnce batch file, standalone installers for Chrome, Firefox, and VLC Player, the OneDrive standalone installer and a few Windows theme files, like this:

Customize Windows

Windows on our reference VM should have started in Audit Mode and signed you in using built-in admin credentials (no user accounts exist yet) by now. A visible telltale that we are indeed in Audit Mode is the Sysprep prompt shown on desktop. Close it for now by clicking Cancel:

VM is now using basic 1024*768 resolution. Change it to something more comfortable if you wish. I prefer to set my screen resolution to 1600*900 when customizing to give myself more workspace.

OK, now it’s time to connect to the network. In the VM, select File > Settings, select Network Adapter on the left pane, select Default Switch (or any other external switch) from the Virtual switch drop down list, and click OK to save settings:

The VM will now have network and Internet connections. Open File Explorer > This PC, map the host Assets folder as a network share entering a path to the share folder: \\HostComputerName\AssetsFolderShareName. Disable (unselect) Reconnect at sign-in, selelct Connect using different credentials, then click Finish:

A prompt will ask you to enter credentials. Enter your host machine admin account username and password, then click OK:

The host Assets folder now resides in File Explorer > This PC on the reference VM. Copy unattend.xml, RunOnce.bat, and the two optional files OneDrive installer and OEM logo to the following folders:

  • unattend.xml to folder C:\Windows\System32\Sysprep
  • RunOnce.bat to folder C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
  • OneDriveSetup.exe to folder C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
  • oemlogo.bmp to folder C:\Windows\System32

Notice that ProgramData and AppData are hidden folders, and are not shown in File Explorer by default.

Run your standalone installers, install all software you want to from the Internet. Do not run any of your installed apps, to avoid them creating user specific AppData folders. Apply desktop theme files, applying last the theme you want to be the default theme for each new user’s first sign-in (the current theme when we sysprep will be the system-wide default theme).

In my case  I first uninstalled OneDrive (Settings > Apps > Microsoft OneDrive > Uninstall), installed Chrome. Firefox and VLC using the standalone installers in the Assets folder, applied all themes, with the last them as the one I want to be the default. I then installed Opera, Office 365 (2016) and some third party tools from the Internet. When all downloads were done, I deleted the contents of Downloads folder because everything left to built-in admin’s user folders now will be copied to default user profile when we sysprep Windows, and from there to any and all new user profiles. If you have any files you need to be present when Windows is installed from this custom image, copy them now to respective folders (Documents, Pictures and so on).

When all this is done, only one step is missing before we can sysprep the image — namely, Disk Clean-up. Open Command Prompt (no need to elevate, we are already using an elevated built-in admin account), and run the following command:

cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535

This opens the Advanced Disk Clean-up prompt. Select each and every item on the list, then click OK to start cleanup operations:

Let Disk Clean-up finish, then close the Command Prompt. Everything done, here’s my reference VM’s desktop, ready to be sysprepped (click to open enlarged in a new tab.):

We will sysprep Windows on reference VM, capture it to a WIM file and create a custom ISO based on it in the fifth and final part of this series. Stay tuned!

Kari

 

 

Author: Kari Finn

A Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

Tags: , , , ,

One Response “Windows 10 Unattended install media – Part 4: Customize Windows Image”

Leave a Reply

This website stores some user agent data. These data are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny
640
%d bloggers like this: