Pages

Tuesday, June 26, 2018

Running sysprep on Windows Server 2012 R2 server fails with: "A fatal error occurred while trying to sysprep the machine."

Problem

You have an existing Windows Server 2012 R2 server that you would like to manually sysprep:

image

So you proceed to navigate to the directory: C:\windows\system32\sysprep to execute the sysprep.exe:

image

Select the Generalize option and click OK:

image

The process starts but quickly fails with the error:

System Preparation Tool 3.14

A fatal error occurred while trying to sysprep the machine.

image

You navigate to the directory:

C:\windows\system32\sysprep\Panther

image

.. and find the following the content in the setuperr.log file:

2017-06-26 10:18:22, Error [0x0f0073] SYSPRP RunExternalDlls:Not running DLLs; either the machine is in an invalid state or we couldn't update the recorded state, dwRet = 0x1f

2017-06-26 10:18:22, Error SYSPRP WinMain:Hit failure while processing sysprep re-specialize internal providers; hr = 0x8007001f

2017-09-18 15:11:15, Error [0x0f0073] SYSPRP RunExternalDlls:Not running DLLs; either the machine is in an invalid state or we couldn't update the recorded state, dwRet = 0x1f

2017-09-18 15:11:15, Error SYSPRP WinMain:Hit failure while processing sysprep re-specialize internal providers; hr = 0x8007001f

2018-06-26 13:21:48, Error [0x0f0073] SYSPRP RunExternalDlls:Not running DLLs; either the machine is in an invalid state or we couldn't update the recorded state, dwRet = 0x1f

2018-06-26 13:21:48, Error SYSPRP WinMain:Hit failure while processing sysprep re-specialize internal providers; hr = 0x8007001f

2018-06-26 13:42:57, Error [0x0f0073] SYSPRP RunExternalDlls:Not running DLLs; either the machine is in an invalid state or we couldn't update the recorded state, dwRet = 0x1f

2018-06-26 13:42:57, Error [0x0f00ae] SYSPRP WinMain:Hit failure while processing sysprep cleanup external providers; hr = 0x8007001f

image

Solution

Most of the posts I found relating to this error message indicates that the rearm limit has been reached but executing slmgr.vbs /dlv to review the Remaining Windows rearm count does not appear to suggest this:

image

From there, I decided to try using the configuration that I usually use for a server that has exceed an arm count to see and it surprisingly corrects the issue.

Begin by launching the registry editor and navigating to:

HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\

Verify that the CleanupState registry key is set to 2:

image

Verify that the GeneralizationState is set to 7:

imageimage

image

Uninstall and reinstall the MSDTC via the following commands:

msdtc -uninstall

msdtc –install

image

Proceed by navigating to the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\

Locate the SkipRearm key and change the value to 1:

imageimage

Rerunning the sysprep.exe executable to start the sysprep process should work as expected now:

imageimage

Once the sysprep completes, use a utility such as PsGetsid64.exe to verify that a new SID was generated for the server.

4 comments:

Unknown said...

THanks you this worked like a charm!!

Anonymous said...

Not works

Anonymous said...

Thanks, that worked great on my Server 2012 R2 server.

Anonymous said...

Thanks. It works.