In this article we will show you how to use PowerShell and Windows System Preparation Tool to prepare a highly customized, personal Windows 10 install image. Before starting the installation, we need to make sure that our computer or virtual machine is not connected to network, because Windows 10 sysprep process will later fail if the PC was connected to Internet during the installation.
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 activation of the computer.
Everything configured in the operating system before (installed software, shortcuts on the desktop, system settings for personalization, network, 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:\Windows\System32\sysprep directory.
Using the Sysprep utility greatly simplifies the installation and configuration of the operating system in a large company. Once prepared standard Windows 10 image installed and configured in the right way, the operating system (with a certain installed software, with the system settings, with the specified rights and restrictions) 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 we are using Build 1607 (Anniversary Update ) of Windows 10, so maybe this bug will be fixed in later builds. Let’s start to sysprep Windows 10.
Step 1 – Boot to Windows 10 Audit Mode
Start Windows installation normally. After reboot or two Windows is installed and process stops waiting your input. At this point we need to click on the Use express settings button. On 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).
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.
As no user profiles exist yet, Windows will use its built-in administrator account to sign in to Audit Mode. 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 fold it.
Until now the installation was done without a network connection. So, you can connect your PC to network and 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 information that you want. In our case we put in the following content:
Windows Registry Editor Version 5.00
“Model”=”Windows 10 Pro Image 10-1-2015”
“SupportHours”=”9am to 5pm ET M-F”
Now, you need to create the oem folder in C:\Windows and put there your logo. Once it is done, just open up the .reg file that we have created earlier and it will automatically add it 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. Default profile is used as base profile when you later create 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:\Windows\syswow64\WindowsPowerShell\v1.0 and then run powershell_ise application.
First thing we need to do is extend our rights to run scripts, in order 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 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 Install-Package script.
. 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 type command
Find-Package -Name Opera, GoogleChrome, VLC, AdobeReader, 7Zip, Zoomit. k-litecodecpackfull | Install-Package
If you need to reboot the system to install the application or update, you can do it. After reboot, the system will return to audit mode.
Step 6 – Disable Telemetry and Data Collection in Windows 10
The 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:\ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f sc delete dmwappushservice
Also you can disable Window 10 tracking using 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.
Save the PSWindowsUpdate.zip archive to a USB drive and (this is important!) right click on it -> Properties -> Unlock.
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:\Windows\System32\WindowsPowerShell\v1.0\Modules.
Run PSWindowsUpdate.cmd as administrator.
That’s all! Available updates will be downloaded and installed automatically.
When the update is complete, you can delete the 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 line 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 Kits\8.1\Assessment and Deployment Kit\Deployment Tools\WSIM\imgmgr.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 default user profile.
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 root of any drive other than C:.
After that you can delete the install.wim and catalog files from the desktop.
Because 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 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
Finally let’s run sysprep. Open up Command Prompt as admin.
Go to Sysprep folder and type in the following command:
Sysprep.exe /generalize /oobe /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.
Sysprep will apply you answer file and shutdown the computer. Now this image is ready to be imaged using your choice of imaging software.
When the computer has booted to imaging and recovery tool, create a system image according to instructions for the program you are using. Once it is done, shutdown 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 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.