In this guide, we will show you how to use PowerShell and Windows System Preparation Tool (Sysprep) to prepare a highly customized, personal Windows 10 install image.
What is Sysprep?
Let me remind you, that the Sysprep.exe utility is used to prepare the reference image and its depersonalization. Sysprep allows you to delete all information related to a specific operating system, including unique identifiers (SID, GUID, etc.), resets the Windows activation and to install apps and drivers in the Audit mode.
Everything configured in the operating system before you run Sysprep (installed software, desktop, system personalization, and network settings, File Explorer, installed and pinned on the start screen Metro apps and other parameters) will remain untouched.
In Windows 10 and Windows Server 2016, the Sysprep.exe utility is located in folder C:WindowsSystem32sysprep directory.
The Sysprep utility greatly simplifies the installation and configuration of the operating system in a large company. Once prepared reference Windows 10 image installed and configured in the right way (with a certain installed software, with the operating system settings, with the specified permissions and restrictions) can be deployed to all computers of the company using MDT, WDS (take a look at Deploying Windows 10 with MDT and WDS), SCCM or manually.
Sysprep Windows 10 Guide
You need to notice that in this guide we are using Build 1607 (Anniversary Update) of Windows 10, so maybe all bugs found in this guide will be fixed in later builds. Let’s start to sysprep Windows 10.
Step 1 – Boot to Windows 10 Audit Mode
First of all, you need to perform a clean Windows 10 installation on your physical computer or a virtual machine. Start Windows installation normally. After reboot or two Windows is installed and the process stops waiting for your input. At this point, we need to click on the Use express settings button. On the next dialog you should not type a username, so don’t enter it (this stage of OS setup has a name OOBE — out-of-box experience for the end user). In OOBE mode, the user must complete the installation of Windows 10 and configure personal settings such as keyboard layout, account, privacy settings.
Instead, press and hold down the CTRL+SHIFT+F3 keys combination. OS will now reboot to a special customization mode, the Windows 10 Audit Mode. Windows 10 will boot in this mode no matter how many times you reboot your computer until sysprep is running.
As no user profiles exist yet, Windows will use its built-in administrator account to automatically sign in to Audit Mode (this account will be further disabled). There is only one visible sign to mark that you have entered the Windows 10 Audit Mode desktop, the Sysprep dialog in the middle of the display. Do not close the sysprep utility window — you will need it at the end of the configuration step. Just minimize it.
Custom Windows settings can be configured in the Audit Mode. There are two ways to apply the settings to the image:
- You can configure only system settings, and import custom user settings using .reg files into a customized WIM image;
- You can configure both user and system settings, and then use the answer file to copy the profile of the built-in Administrator account to the default user profile.
Until now the installation was done without a network connection. So, you can connect your PC to the network and configure the Internet now.
Step 2 – Download and Install the Windows 10 ADK
What we are going to do next is to download and install the Windows 10 Assessment and Deployment Kit (ADK). First of all, we need to install the Windows System Image Manager (WSIM), a part of the Windows ADK. You can download it from the links below:
Once it is downloaded, run the installation file. Here you don’t need to change the location, so click on Next. After that accept the license agreement and go ahead.
Now you need to select the features you want to install. In our case, we just need to install only WSIM, so put the mark only on Deployment Tools and click on Install.
Step 3 – Install OEM information and logo
It’s very easy to install OEM information and logo. You just need to create the .reg file and put the information that you want. In our case we put in the following code:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionOEMInformation] “Logo”=”CWINDOWSoemOEMlogo.bmp” “Manufacturer”=”TheITBros, LLC” “Model”=”Windows 10 Pro Image 10-1-2015” “SupportHours”=”9am to 5pm ET M-F” “SupportURL”=http://theitbros.com
Now, you need to create the oem folder in the folder C:Windows and put there your company logo image file. Once it is done, just open up the .reg file that we have created earlier and it will automatically add these settings to the registry.
Step 4 – Begin customization in Windows 10 Audit Mode
After entering the audit mode, you can start installing, updating applications and configuring the operating system settings. All these apps and settings would be present in the default user profile. The default profile is used as a base profile when you create new users on your Windows PC.
To install default all user apps we will use PackageManagement (aka OneGet), an integrated module of PowerShell. We cannot just go to the Start Menu and to the Search, because they are disabled in Windows 10 Audit Mode. So, we need to start PowerShell manually by browsing deep into Windows folder and starting it from there.
Go to C:Windowssyswow64WindowsPowerShellv1.0 and then run powershell_ise.exe application.
The first thing we need to do is to allow you to run PowerShell scripts, to be able to install software from a package provider later on.
All we need is just type Set-Executionpolicy Unrestricted command.
Now we need to use the package manager or provider. The package manager we will use now is called Chocolatey. It needs an unrestricted script execution policy, which is why we set it first thing after the PowerShell had started.
To add a provider we need to type Get-Packageprovider Chocolatey command.
Step 5 – Install the software you need
To install all the software that we need, we just have to use the PowerShell cmdlet – Install-Package.
Let’s say we want to install Opera, Google Chrome, VLC, Adobe Reader, 7Zip, K-Lite Codec Pack Full, and Zoomit.
To do it, you need to use the command:
Find-Package -Name Opera, GoogleChrome, VLC, AdobeReader, 7Zip, Zoomit. k-litecodecpackfull | Install-Package
If you need to reboot the Windows to install the application or update, you can do it. After reboot, the system will return to audit mode.
You can also install drivers for all computers and laptops models on which you want to deploy this reference Windows 10 image. Download and unpack the driver packages to a specific directory, then search for all *.inf files and add all the drivers described in them to the Windows image using the command:
for /f %i in ('dir /b /s *.inf') do pnputil.exe -i -a %i
You can use our script to clear the driver store from driver duplicates.
Configure background, Start Tiles, desktop icons, Taskbar Pinned Items, homepage and search options ad over options as required. Then grab current Start Tiles setting using the PowerShell command (to apply these setting to all users):
Export-StartLayout -Path $ENV:LOCALAPPDATAMicrosoftWindowsShellLayoutModification.xml
Step 6 – Disable Telemetry and Data Collection in Windows 10
Windows 10 collects information about the operation of users on the computer. Examples of handwriting and voice samples, location information, error reports, calendar contents – all this can be sent to Microsoft servers
If you do not want your OS to automatically send data to MSFT servers, you can disable the Telemetry and Data Collection.
Run the elevated command prompt and execute the following commands:
sc delete DiagTrack sc config DcpSvc start=disabled echo "" > C:ProgramDataMicrosoftDiagnosisETLLogsAutoLoggerAutoLogger-Diagtrack-Listener.etl reg add "HKLMSOFTWAREPoliciesMicrosoftWindowsDataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f sc delete dmwappushservice
Also, you can disable Windows 10 tracking using the DisableWinTracking tool from GitHub.
Step 7 – Installing Windows Update in Audit mode
Starting with Windows 8.1, in the auditing mode, you cannot install updates using the Windows Update Center in Settings panel.
The Windows Update Center checks to see if the system has completed the OOBE stage (from which you are logged in). If not, the update is not performed.
To automatically update the system from the console, you can take on a very handy PowerShell module — the PSWindowsUpdate Module from TechNet Gallery.
Save the PSWindowsUpdate.zip archive to a USB drive and (this is important!) right click on it > Properties > Unblock.
Create file PSWindowsUpdate.cmd on the USB drive with one command:
PowerShell -ExecutionPolicy RemoteSigned -Command Import-Module PSWindowsUpdate; Get-WUInstall -AcceptAll -IgnoreReboot
Unpack the PSWindowsUpdate.zip to the folder: C:WindowsSystem32WindowsPowerShellv1.0Modules.
Run PSWindowsUpdate.cmd as administrator.
That’s all! Available updates will be downloaded from the Windows Update servers and installed automatically.
When the update is complete, you can delete the PSWindowsUpdate module that was previously copied to the Windows folder.
Step 8 – Uninstall built-in apps
Also, you can uninstall built-in apps, but it’s really up to you. So, if you don’t want to uninstall built-in apps, just skip this step.
Paste the following scripts onto the PowerShell command prompt and press Enter.
Get-AppxPackage *3dbuilder* | Remove-AppxPackage Get-AppxPackage *windowsalarms* | Remove-AppxPackage Get-AppxPackage *Appconnector* | Remove-AppxPackage Get-AppxPackage *windowscalculator* | Remove-AppxPackage Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage Get-AppxPackage *windowscamera* | Remove-AppxPackage Get-AppxPackage *CandyCrushSaga* | Remove-AppxPackage Get-AppxPackage *officehub* | Remove-AppxPackage Get-AppxPackage *skypeapp* | Remove-AppxPackage Get-AppxPackage *getstarted* | Remove-AppxPackage Get-AppxPackage *zunemusic* | Remove-AppxPackage Get-AppxPackage *windowsmaps* | Remove-AppxPackage Get-AppxPackage *Messaging* | Remove-AppxPackage Get-AppxPackage *solitairecollection* | Remove-AppxPackage Get-AppxPackage *ConnectivityStore* | Remove-AppxPackage Get-AppxPackage *bingfinance* | Remove-AppxPackage Get-AppxPackage *zunevideo* | Remove-AppxPackage Get-AppxPackage *bingnews* | Remove-AppxPackage Get-AppxPackage *onenote* | Remove-AppxPackage Get-AppxPackage *people* | Remove-AppxPackage Get-AppxPackage *CommsPhone* | Remove-AppxPackage Get-AppxPackage *windowsphone* | Remove-AppxPackage Get-AppxPackage *photos* | Remove-AppxPackage Get-AppxPackage *WindowsScan* | Remove-AppxPackage Get-AppxPackage *bingsports* | Remove-AppxPackage Get-AppxPackage *windowsstore* | Remove-AppxPackage Get-AppxPackage *Office.Sway* | Remove-AppxPackage Get-AppxPackage *Twitter* | Remove-AppxPackage Get-AppxPackage *soundrecorder* | Remove-AppxPackage Get-AppxPackage *bingweather* | Remove-AppxPackage Get-AppxPackage *xboxapp* | Remove-AppxPackage Get-AppxPackage *XboxOneSmartGlass* | Remove-AppxPackage
Step 9 – Create Windows 10 Sysprep Answer file
Now we need to create an Answer File. An answer file is a set of instructions in an XML file. When sysprep is run, it reads these instructions, what changes it should make to the Windows image.
At first, we need to create a catalog file. For that, we need the install.wim file from a Windows install disk or ISO file.
Note. Windows 10 Build 9926 install.wim file for some reason cannot be used for the catalog file. This will be fixed in future builds, for sure. But for now, we have a workaround.
To get an answer file for our Build 9926, at first, we have to create the catalog using Windows 8.1 or Windows 10 Builds 9841, 9860 or 9879 install.wim file, and later edit the answer file.
Find the install.wim on any install media for above mentioned Windows versions and copy to the desktop of the PC you are using for this process now.
The install.wim can be found in Sources folder in any Windows install media. We are using the install.wim from Windows 8.1 Update 1.
Open Windows System Image Manager.
Location of the Windows System Image Manager is:
C:Program Files (x86)Windows Kits8.1Assessment and Deployment KitDeployment ToolsWSIMimgmgr.exe
Now, create a new answer file, and select the install.wim we just copied to the desktop.
Creating the catalog will take quite a long time.
Once it is done, we need to do the most important thing, set the CopyProfile value to TRUE. This setting is telling Sysprep to copy all our customizations to the default user profile.
In the answer file, you can configure any other system options that you want to use, for example, the Windows product key (if you are using KMS or MAK keys), time zone, organization and owner info, default language and region settings, input locales, etc.
Once it is done, let the Windows SIM validate your answer file and check it for errors. Click on Tools -> Validate.
In our case it is nothing to be worried about, only warnings about some deprecated settings no longer possible to change, and notices that because we did not change some settings, they will be left out.
Now, we can save the answer file and name it as we want to. But the file extension must always be .xml. Save the answer file to the root of any drive other than C:.
After that you can delete the install.wim and catalog files from the desktop.
Because of the install.wim file that we have used is not belonging to the version of Windows we will Sysprep, the answer file must be edited. So, open it in Notepad.
Change the path to your Windows 10 install.wim file at the bottom of the answer file. In our case, we need to change the drive and Windows version to Windows 10 Pro. Now, save this file as CustomImage.xml on the drive D:.
Step 10 – Run Sysprep in Windows 10
After you create your answer file you can run sysprep. Open up Command Prompt as admin.
Go to Sysprep folder and type in the following command:
Sysprep.exe /generalize /oobe /generalize /shutdown /unattend:D:CustomImage.xml
In our case, the answer file is on the root of the drive D:. Change the command according to where your answer file is located.
Tip. If you run sysprep with the /copyprofile option, the local user profile will be copied to the default user profile, and then will become the default profile in the Windows 10 image.
Sysprep will apply your answer file and shutdown the computer. Now this image ready to be deployed on other devices with your default user profile using your choice of imaging software (you can capture and deploy this image using MDT).
Tip. If during running Sysprep an error appears: Sysprep Was Not Able to Validate Your Windows Installation, read carefully the following guide.
When the computer has booted to the imaging and recovery tool, create a system image according to instructions for the program you are using. Once it is done, shut down the computer.
You have created a generalized, highly customized Windows install image which can be restored to any computer instead of installing. Restoring takes only half of the time needed for installation.
Start PC normally to finalize the installation.
The Welcome phase first boot is a bit different in a Sysprepped Windows. You will be asked to enter the product key. This is of course not necessary, you can skip it.
Now, create a local account. You can later change it to a Microsoft Account.
Finally, we did it. After installation you will see that all customizations are there, all the software you installed in Audit Mode are there as well.
That’s all. If you have any questions about this Sysprep Windows 10 tutorial, you are free to leave them in the comments section below.