Sysprep Errors with Server 2008R2, SkipRearm, and slmgr.vbs – SOLUTION

Have you run into an issue sysprepping  in your virtual or Citrix environment using Vista, Windows 7 or Server 2008 including R2?  Are you getting “Fatal Errors”?  Are you frustrated with the lack of Microsoft knowledge on how to fix the problem?  Or perhaps Microsoft’s lack of commitment to fixing the problem?  Well, look no further.

I’ve run into the same problem recently with my Server 2008 R2 x64 Standard image.  Over the last couple of years, I’ve updated it to include VMware Tools updates as well as various Microsoft updates.  Well, one thing I didn’t know what that Microsoft was keeping track of the “rearming” process.  They only give you three (unless you’re aware of it and can disable it early).

I first ran slmgr.vbs /dlv.  Within a few seconds I could clearly see that I had no rearms left.  Then I searched high and low and tried all the responses from Microsoft employees on the various Microsoft boards as well as some others.  No dice.

Then I was able to piece together a couple of articles and share them here.  Putting both together in the proper order SOLVED my issue.  First, credit is due to these two people/webpages:

  1. Tim at Microsoft – It’s the second entry down and his handle is “butim”.  Here’s the link:
    Note: You will need the code from his post
  2. Leonard from the OLEGM blog.  Here’s the link:

OK, now that credits are out of the way, here’s the solution that FINALLY worked for me:

  1. I had indeed run out of “rearms” and slmgr.vbs /dlv showed 0 for the count.
  2. First, I created the “skiprearm.xml” that was a recommended approach in one of the other articles.  It didn’t work.  But hold on, because you’ll still need it later on.  That article can be found here: click here and you should copy and paste the code and store it where they want.
  3. Next, and this is the MONEYchange….you must check/edit 3 registry keys:
    1. HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\GeneralizationState\CleanupState:2
    2. HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\GeneralizationState\GeneralizationState:7
    3. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\SkipRearm:1
  4. Next, Start -> Run : msdtc -uninstall (wait few seconds)
  5. Start -> Run : msdtc -install (wait few seconds)
  6. Restart the machine
  7. Check the registry for the right registry keys values sysprep with the new XML answerfile
  8. Run the following command from a command prompt:
    1. sysprep /generalize /oobe /shutdown /unattend:c:\Windows\skiprearm.xml

It should now work for you.  And it makes sense because were changing anything Microsoft may have done by skipping rearm, changing the generalization state, then reinstalling MSDTC.

Please let me know if this works for you.

Take Care>>>Dustin

This entry was posted in Computers and Internet and tagged , , , , , , , . Bookmark the permalink.

43 Responses to Sysprep Errors with Server 2008R2, SkipRearm, and slmgr.vbs – SOLUTION

  1. Laura says: are a gem. You just saved me hours on a rebuild.

  2. ian j hart says:

    Minor update. Whilst this did work, in the sense that I could sysprep a computer with no rearms, the referenced skiprearm.xml does not prevent the rearm count from decrementing. This is because the architecture is set to x86. Here’s a version which works under amd64. Note the rename of the component Typical MS!

  3. Pingback: VMware Template Deployments–Part 1: Trying to modify « vNetWise

  4. Tristan Buckley says:

    Thank-you very much 🙂 End of my sysprep woes!

  5. Andrew says:

    Hi, I have had the same problem for several years (win7,skipped vista), I found your soloution and read the responses… Im working on a image for Latitude E4300 (image for about 80machines)…
    I started up in audit mode and finished the image, got the message this time as well.. after i uninstalled and installed msdtc, when i restart, it get’s stuck at: “The Installationprogram is making the computer ready for first time use” (been at that screen for hours)

  6. Barry says:

    Dustin, you’re a goddamn IT hero (imho)! Was tearing my hair over a physical R2 sysprep. Had found half the solution & you filled in the blanks.


  7. David Yoshida says:

    Thanks. Saved me hours.

  8. Jason says:

    This did not work for me. My counter is at zero, I followed the instructions explicitly and no go.

    • Dustin Lema says:

      I’m sorry this didn’t work for you. It has worked for many others. You’ll probably have to call Microsoft support to get it figured out more quickly. Thanks for visiting!

      • Jason says:

        I tried to says prep a Dell windows 7 home install. I crashed once to my knowledge. I am super pissed. I saw something on a website that indicated you could run a batch file to reset the activation code but the batch file did not find the reg keys on my system. I just need stupid sysprep to work 1 time. This is ridiculous.

  9. Mahesh says:

    Awesome, worked for me, Saved in Favroate. Thanks a lot, was searching from few days .we have vmware & facing same issue while cloning.

  10. Marcel says:

    Thank you very much. Ian

  11. Matto says:

    You are the man… Saved me from so much pain… Many thanks

  12. Chris says:

    Awesome, easy to understand article! Good Work! This has saved me a countless number of hours. I am going back to my gold image and applying this to create new images! I will never have this issue again thanks to you and the techs whom you gave credit where it was do. (Its nice to see honest techs still out there!) Nice job putting the necessary steps in order to make this work.

  13. Bob Rein says:

    Thank you for this post, I wrote a VBS script for windows 2008 R2 64 Bit to do just this, it is below:

    Option Explicit
    Dim objFS,outrec,strFile,objFile
    Set objFS = CreateObject(“Scripting.FileSystemObject”)
    strFile = “c:\windows\system32\sysprep\skiprearm.xml”
    Set objFile = objFS.CreateTextFile(strFile,true)


    WSCript.Echo “Creating skiprearm.xml file”
    objFile.Write(outrec & vbCRlf)

    objFile.Write(outrec & vbCRlf)

    outrec=” ”
    objFile.Write(outrec & vbCRlf)

    outrec=” ”
    objFile.Write(outrec & vbCRlf)

    outrec=” 1″
    objFile.Write(outrec & vbCRlf)

    outrec=” ”
    objFile.Write(outrec & vbCRlf)

    outrec=” ”
    objFile.Write(outrec & vbCRlf)

    objFile.Write(outrec & vbCRlf)

    WSCript.Echo “Done creating skiprearm.xml file”


    WSCript.Echo “Changing the Following Registry Keys”
    Wscript.Echo “A.HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\GeneralizationState\CleanupState:2”
    WSCript.Echo “B.HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\GeneralizationState\GeneralizationState:7”
    WSCript.Echo “C.HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\SkipRearm:1”


    const HKEY_LOCAL_MACHINE = &H80000002
    DIM strComputer, oReg,strKeyPath,strDWORDValueName,strValueName,dwValue
    strComputer = “.”

    Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_
    strComputer & “\root\default:StdRegProv”)

    strKeyPath = “SYSTEM\Setup\Status\SysprepStatus”
    strDWORDValueName = “CleanupState”

    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName
    strKeyPath = “SYSTEM\Setup\Status\SysprepStatus”
    strValueName = “CleanupState”
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

    strKeyPath = “SYSTEM\Setup\Status\SysprepStatus”
    strDWORDValueName = “GeneralizationState”

    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName
    strKeyPath = “SYSTEM\Setup\Status\SysprepStatus”
    strValueName = “GeneralizationState”
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

    strKeyPath = “SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform”
    strDWORDValueName = “SkipRearm”

    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName
    strKeyPath = “SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform”
    strValueName = “SkipRearm”
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

    WSCript.Echo “Done Updating Registry Keys”



    Dim WshShell
    WSCript.Echo “Un-Installing MSDTC”
    Set WshShell = WScript.CreateObject(“WScript.Shell”)
    WshShell.Run “msdtc -uninstall”
    WSCript.Echo “Re-Installing MSDTC”
    WshShell.Run “msdtc -install”

    WSCript.Echo “Script is now competed”

  14. Dustin Lema says:

    Thank you Robert!

  15. David C says:

    Some serious bad@ss IT sharing going on here! Thanks Dustin & Robert, flawless stuff. If my time permitted, it convert your VBS to PS. Someday!

  16. Eugene says:

    This is awesome. Thanks Dustin and more importantly thanks Bob.

    Copying and pasting this script breaks it so I had to fix some of the quotes but looks like its working and I’m back on track.

  17. Brian says:

    I just did it all without uninstalling and reinstalling MSDTC, and it seems to have worked (rearm count is still at 3). Will there be any negative side effects of not reinstalling MSDTC?

  18. Baggio says:

    Hello Robert,

    Could you please put a download link for your great VBS script.


  19. SHaun says:

    Thanks, This has saved me loads of time!!!

  20. Ingo says:

    Thanks for your Post, was a great help for me.

  21. Patrice says:

    Great ! Thank you !

  22. Triumf says:

    Thank You!

  23. scorpionking says:

    OMG, I tried many solutions on the net, nothing worked…except for this. Even without the xml file. Thank you Thank you Thank you, saved me hours of work.

  24. ikkedejong says:

    Works, like a charm, without using the xml-file even. So what I did was:

    – Check the registry for the first two values (they are there)
    – Change the third value, from 0 to 1
    – uninstall and install msdtc
    – reboot
    – sysprep

    And that was all that was needed. Thanks a lot, saves us a bundle of work.

  25. Pingback: Windows Server 2008R2, XenApp 6.5, Sysprep “Windows could not finish configuring the system” (error 0x8007139f) :

  26. Mark Hatfield says:

    I just set the skiprearm to 1, reboot and run sysprep.
    Works for my 2008R2 and Windows 7 images with 0 remaining rearms.

  27. Niels says:

    Eventually after applying the unattend.xml file the SkipRearm process is really skipped and the sysprep succeeds, this took me a while. Good article and helpfull investigation, thank you.

  28. Paul says:

    Thanks Dustin, this worked for me (didn’t need the skiprearm.xml though)

    Thanks so much for consolidating this information into a usable page that gets results!


  29. Greg says:

    Thanks Dustin;
    This worked as expected, The only step I had to perform was STEP #3.
    .Next, and this is the MONEYchange….you must check/edit 3 registry keys:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\SkipRearm:1
    Once I exited regedit it prompt me to reboot, after the reboot I was able to Sysprep.
    Also thanks to ALL who have posted.

  30. ltcadman says:

    Does anyone know if this rearm limit still applies to 2012 and 2012 R2

  31. Pingback: Tech Link List - Savage Nomads

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s