Part of the process used in creating a Windows image that can be deployed to multiple PCs is using Sysprep to generalize the image. Sysprep removes the system ID (the computer’s SID) from the Windows installation so that it can be safely cloned.
Those who have worked in IT for a long time know that Sysprep has been around for decades. Unfortunately, the tool is starting to show its age. If you have ever tried to use Sysprep to generalize a Windows 10 deployment, you have likely received an error message similar to the one shown in the screenshot below. So let’s take a look at why Sysprep tends to be so problematic, and what you can do to get around these potential errors.
If you try to generalize a Windows 10 deployment using Sysprep, you are likely to receive an error message like the one you see above.
Sysprep errors in Windows 10 are very often tied to the existence of modern Windows applications (Metro apps, Windows Store apps, or whatever Microsoft is calling them this week). Getting a handle on these apps is key to making Sysprep work.
In preparation for this article, I set up a virtual machine and installed a clean copy of Windows 10. You can see this Windows installation in the image below. One of the first things that I am sure that you will notice is all of the bloatware that is installed by default. Keep in mind that I didn’t install a consumer edition of Windows. This edition is geared toward businesses. Hence, an administrator who wishes to Sysprep this image probably wants to first remove Netflix, Candy Crush Saga, and all of the rest of the garbage that is completely out-of-place in a business environment.
While getting rid of the unwanted applications and possibly installing a few business apps prior to running Sysprep sounds like a sound strategy, there is a problem with doing so. According to Microsoft, “installing new Microsoft Store apps or updating your existing Microsoft Store apps before generalizing a Windows image will cause Sysprep to fail.”
In other words, the very existence of the unwanted applications can in a roundabout way cause Sysprep to fail, because once Windows has been installed it almost immediately launches into an update cycle, and the update process can break Sysprep.
If you want to deploy and then Sysprep Windows, then my advice is to begin the process by downloading the most current deployment image possible. Since updating Windows before running Sysprep tends to cause problems, it is best to start out with an up-to-date deployment image, so as to minimize the updates that are going to be required later on.
As for the installation process, install Windows into a virtual machine just as you normally would, but with one caveat. Before you begin the installation process, disconnect the virtual network adapter. This will prevent Windows from downloading any updates. When Windows is installed in this way, the Start menu will appear somewhat incomplete, as shown below.
Now you can begin removing the unwanted application packages. There are a few different ways of doing this, but I personally prefer to use PowerShell. From an administrative PowerShell session enter the following command:
Get-AppxProvisionedPackage -Online | Select-Object PackageName
This command lists all of the application packages that are currently installed. You can remove a package by using this command:
Remove-AppxProvisionedPackage -Online -PackageName <package name>
You can see what these commands look like in the next image. It is worth noting that I am using copy and paste to help reduce the amount of typing required when entering package names. It is also worth noting that you don’t have to remove every package. Some packages, such as the calculator, may have business value.
Now that the unwanted application packages have been removed, it is time to remove the actual applications. To do so, you can use these commands:
Get-AppxPackage | Select-Object Name Get-AppxPackage *name* | Remove-AppxPackage
The first command lists all of the applications that are installed, while the second command performs the removal of a specific application (replace *name* with the application package). You can see an example of this below.
By the time that you get done, the Windows desktop will probably look something like what you see below. As you can see in the screenshot, there may be a few leftover start menu tiles that you have to manually remove.
After a few mouse clicks, the unwanted tiles are gone.
Now it’s time to try running Sysprep again. This time, Sysprep is able to generalize Windows without any issues. When you run Sysprep, be sure to choose the option to shut down the PC once Sysprep completes.
As you can see, the key to making Sysprep work with Windows 10 is to disconnect the network adapter to prevent any updates from being installed, remove any unwanted apps, and avoid installing any modern applications. Supposedly, it is possible to install applications prior to performing a Sysprep so long as you sideload those applications, but I have never tried it, so I don’t know if the technique actually works or not.
If you have taken the time to work through the process of preparing a PC for Sysprep, then you have no doubt noticed that the preparation process is tedious and time-consuming. If you find that you need to use Sysprep to create new images on a periodic basis, then I would strongly recommend creating a PowerShell script that automates the cleanup process. Building such a script would involve a little bit more time up front, but would be a huge time saver later.
Featured image: Shutterstock
The world is filled with tech that many people consider to be extinct. But some of these “obsolete” technologies are…
NASA’s Jet Propulsion Laboratory, no stranger to cybersecurity problems, found some outgoing email blocked after employees fell for a phishing…
The Linux Certified System Administrator exam can be an important career step. Here’s a close look at what is covered…
You’ve planned, you’ve analyzed, you’ve tested. But your large IT projects still fail. Why does this keep happening? And what…
Why are big companies turning to container technology? It’s cost effective, agile, and easy-to-use, thus saving the hassles of complex…
You might not think of PowerShell as your go-to tool for managing Group Policy settings, but it does have its…