Share via

Sysprep Failed - Windows Server 2016 & 2019

Hadjer YAHIAOUI 156 Reputation points
2021-05-23T15:25:56.8+00:00

Hello,

I prepared my VMware 6.5 template using sysprep with the shutdown option on a new VM (Windows no activated) and then convert the VM to template.

the command used:
sysprep.exe / oobe / generalize / shutdown / mode: vm /unattend:C:\unattend.xml

the response file:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm=http://schemas.microsoft.com/WMIConfig/2002/State xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<settings pass="generalize"> <component name="Microsoft-Windows-PnpSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls></component></settings>
<settings pass="oobeSystem"> <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> <InputLocale>fr-FR</InputLocale> <SystemLocale>fr-FR</SystemLocale> <UILanguage>fr-FR</UILanguage> <UserLocale>fr-FR</UserLocale><UserAccounts><AdministratorPassword><Value>#####</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts> </component> </settings>
</unattend>

When deploying VMs from this Template new SIDs were generated but I noticed some time after that it didn't work anymore. And when I run a sysprep on the VM after deployment I get the error: 'A fatal error occurred while trying to sysprep the machine'

I applied the solution proposed in the forumes: Change the value of the GeneralizationState key from 3 to 7 and it's works!!!

FYI:

  • I encountered this problem for both versions of windows server 2016 and 2019.
  • CleanupState = 2 & SkipRearm = 0 before and after applying the solution.
  • Guest OS Custumization during deployment of a VM does not work: same SSID generated.

My question is: I want to fully understand this phenomenon and the meaning of the value of the registry key GeneralizationState 3 and 7? to make sure that this problem will not happen again in the future.

Thank you in advance for your help.
Looks.
Hadjer YH

Windows for business | Windows Server | User experience | Other
0 comments No comments

Answer accepted by question author

Teemo Tang 11,501 Reputation points
2021-05-25T02:19:23.58+00:00

I have explained on my last reply why we see the error message” A fatal error occurred while trying to Sysprep the machine”, this message appeared because:
Even though there is no limit to the number of times that the Sysprep command can run on a computer. However, the clock for Windows Product Activation begins its countdown the first time Windows starts. You can use the sysprep /generalize command to reset Windows Product Activation a maximum of three times. After the third time that you run the sysprep /generalize command, the clock can no longer be reset.

Check this Microsoft for a hint:
SkipRearm | Microsoft Learn
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/ff716063(v=win.10)?redirectedfrom=MSDN
If you anticipate running the Sysprep command multiple times on a single computer, you must use the SkipRearm setting in the Microsoft-Windows-Security-Licensing-SPP component to postpone resetting the activation clock. Because you can reset the activation clock only three times, if you run the Sysprep command multiple times on a computer, you might run out of activation clock resets. We recommend that you use the SkipRearm setting if you plan on running the Sysprep command multiple times on a computer.

About your question: “the meaning of the value of the registry key GeneralizationState 3 and 7”. Sorry, there is not a Microsoft official document explains the meaning of this registry value.
In order to check if we can continue sysprep on current machine, we could run the slmgr.vbs script with /dlv parameter, you could find remaining rearm count…. for ex, 3 says you can sysprep it more 3 times.

-------------------------------------------------------------------------------------

If the Answer is helpful, please click "Accept Answer" and upvote it.
Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Hadjer YAHIAOUI 156 Reputation points
    2021-05-26T12:52:47.483+00:00

    Hello, Thank you very much for your explanation !! now I understand better the big part of the problem. However, a few points still seem unclear to me: 01 - According to the Microsoft communicated link: the limit of 3 rearm is applied to versions Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2 and months I am on Win server 2016 and Win server 2019 and this explains the value Reamaining Windows rearm count = 995 after executing the slmgr.vbs / dlv command (capture attached) and what I confirm with the link below: https://learn.microsoft.com/en-us/windows- hardware / manufacture / desktop / sysprep - generalize - a-windows-installation # limits-on-how-many-times-you-can-run-sysprep am I true ?? 02 - in my current case: I deployed a new VM, and the result after booting: new SSID, SkipRearm = 0, GeneralizationState = 7, CleanupState = 2, Reamaining Windows rearm count = 995 (attached captures) **** If I only change the GeneralizationState to 3 value on the same VM does not work. **** Another Sysprep on the same VM with GeneralizationState = 7 On. Thank you very much for your help and explanations Looks. Hadjer YH. ![99837-error.png][1]![99819-reamaining-windows-rearm-count.png][2]![99838-generalizationstate.png][2]![99759-skiprearm.png][3] ![99931-reamaining-windows-rearm-count.png][4] [1]: /api/attachments/99837-error.png?platform=QnA [2]: /api/attachments/99838-generalizationstate.png?platform=QnA [3]: /api/attachments/99759-skiprearm.png?platform=QnA [4]: /api/attachments/99931-reamaining-windows-rearm-count.png?platform=QnA

    Was this answer helpful?

    0 comments No comments

  2. Hadjer YAHIAOUI 156 Reputation points
    2021-05-24T11:07:52.78+00:00

    Hello All,

    Thank you for your answers !!!

    Let me explain: I have already applied the solution and it worked (setting the value of GeneralizationState to 7 the problem has been fixed even if the value of SkipRearm is equal to 0 /// the value of CleanupState is already at 2)

    and now it works too and I just tried more than 15 deployments with the same template and without the unattend.xml and a new SSID and generated each time.

    My question is: I want to fully understand the meaning of the value of the registry key GeneralizationState 3 and 7? to make sure that this problem will not happen again in the future. And this is what the impact of the unattend.xml repnse file is that even with it worked for a while.

    What can guarantee that sysprep will run on every deployment! ?

    Thank you in advance for your help.
    Looks.
    Hadjer YH

    Was this answer helpful?

    0 comments No comments

  3. Teemo Tang 11,501 Reputation points
    2021-05-24T02:12:04.99+00:00

    Hi Hadjer YH,

    As you may know, Windows Server 2016 or 10, cannot be rearmed more than three (3) times. This means that you can run Sysprep on the same machine (or image) only 3 times. If you try to run sysprep more than 3 times, then the "System Preparation Tool" will give you this error message: "A fatal error occurred while trying to Sysprep the machine"
    The three (3) times rearm (sysprep) limitation is applied because when you run sysprep, you reset the period (limit) of 30 days to activate your Windows copy. If you able to run Sysprep with no limits, you should run Windows forever without any activation.

    The easy way to get around the three time limit of sysprepping is to either a) use a virtual machine and save a snapshot before the first time you sysprep, or b) capture an image through the console of the state before sysprepping, and then deploy it when it to the same class machine when it needs updated. If you accidentally reached the three rearm limit without having to start over from scratch, here is a step by step how to get around it

    1) Open up Registry Editor. (Start > Run > regedit)
    2) Browse to HKEY_LOCAL_MACHINE\System\Setup\Status\Sysprep Status.
    3) Change the value of CleanupState to 2. (0x00000002)
    4) Change the value of GeneralizationState to 7. (0x00000007)
    5) Browse to HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\SoftwareProtectionPlatform.
    6) Change the value of SkipRearm to 1. (0x00000001)
    7) Open an administrative command prompt. (Start > Run > cmd... right click on the cmd icon and go to Run as Administrator)
    8) Type msdtc -uninstall and push enter. Wait a minute and reboot.
    9) Type msdtc -install and push enter. Wait a minute and reboot.
    10) Browse to c:\windows\system32\sysprep. Delete the panther folder.
    11) Run sysprep. It should now complete, and you can capture the image.
    This will have to be done every time you capture the image, but it still is less time consuming than starting over from scratch.
    Source:
    https://community.broadcom.com/symantecenterprise/communities/community-home/librarydocuments/viewdocument?DocumentKey=c2d9c86c-53ba-47c4-8155-6e548a548aee&CommunityKey=e2fbb15e-15c3-430b-97f3-4871e488162b&tab=librarydocuments

    Regards


    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

  4. Pavel yannara Mirochnitchenko 13,451 Reputation points MVP
    2021-05-23T16:58:25.307+00:00

    Try to sysprep without unattend.xml

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.