Many organizations use serial numbers as the naming convention for devices in SCCM.

For most devices, this is not an issue, but if you are using this for virtual machines, you may run into some issues.

This is because there is a limit for how long computer names can be in SCCM.

I noticed this issue at a customer where they were deploying machines using SCCM and automatically configuring the machine name according to the serial number.

This blog post covers how to fix the error you will see in the smsts.log file during the Apply Windows Settings step in SCCM.

What is the 0x8022005 error code in SCCM?

Machine installations using SCCM might fail during the Apply Windows Settings step with the following error code:

Failed to open the Task Sequencing Environment. Code 0x80220005. Please ensure you are running this executable inside a properly configured OS

In my specific scenario, the customer used virtual machines and automatically generated names based on the serial number.

The reason why you may see this error is that SCCM does not support computer names longer than 16 characters.

How to fix the 0x8022005 error code

If you have a script that sets the serial number automatically, you will need to configure it to only take the first 16 characters of the serial number. This will fix the 0x8022005 error code.


Keep in mind that there is a limit to how long names can be in SCCM. In most cases, you should be fine :).

Related posts

Subscribe to newsletter:

If you want to receive the latest news for MEMCM, Windows 10, and Powershell, please subscribe to my monthly newsletter!


  1. Any tips on what specifically to edit in the script?

    set env = CreateObject(“Microsoft.SMS.TSEnvironment”)
    Set ProgressUI = CreateObject(“Microsoft.SMS.TsProgressUI”)
    Set SWBemlocator = CreateObject(“WbemScripting.SWbemLocator”)
    Set objWMIService = SWBemlocator.ConnectServer(strComputer,”root\CIMV2″,UserName,Password)
    Set colItems = objWMIService.ExecQuery(“Select * from Win32_BIOS”,,48)

    For Each objItem in colItems
    env(“OSDComputername”) = objItem.SerialNumber

    • Hi Danielle, what script are you referring to? As to my knowledge, 16 characters is the limit for computer names in SCCM. If you have a script for naming machines, I would recommend handling VMs as exceptions, with other naming conventions than serial numbers.

  2. Hi Daniel, you’re referring to 16 characters, actually it’s a Windows limitation and Windows only accepts upto 15 characters as a computer name. During the Apply Windows Settings ConfigMgr is updating the unattend.xml to contain the actual hostname on running the OOBE process where the unattend.xml being processed on the first boot into the main OS.

    So there one limitation more on the computername it can’t be fully numeric like 1234568. That’s also not supported from a Windows perspective I’ve tested a few combinations that will work though but it’s not supported and will error out.


Please enter your comment!
Please enter your name here