You might see this error when you try to deploy Windows from SCCM.
Task Sequence: has failed with the error code (0x80220005)
The step running when failing is Apply Windows Settings:
SMSTS.log will further more show this information:
Failed to open the Task Sequencing Environment. Code 0x80220005. Please ensure you are running this executable inside a properly configured OS Deployment task sequence.
In this example the problem is that I am trying to use a computer name longer than 15 characters, so if you see this error check your computer name (also tailoring spaces!).