Having trouble with deploying a VMware Windows 2008 R2 Template and it failing to sysprep? It could be you’ve sysprep’d the template image too many times. Here’s the fix.
Microsoft decided with 2008R2 and older OS’s that to help curb piracy you could only use sysprep to rearm the Windows activation counter 4 times. This is fine until you have a sysprep’d image that you want to maintain or if you inherit an image that has already used up it’s 4 rearms and you need to deploy a new server from the image.
The official solution is to rebuild the image – which is fine because every image comes with a detailed rebuild guide, right? 🙄
At least in Windows 2012 this problem has been mitigated as the rearm counter is now set at 1000.
Wouldn’t it be nice if there was a sneaky fix to reset the rearm counter? Well there is.
Be warned you will need to re-enter your activation key and reactivate Windows using this process (not a big issue if you are using a KMS key). You will also need to know the local administrator password of the server.
To check the re-arm counter fire up the server (convert the template to a VM if necessary) and log in. From a command prompt run:
Have a look at the re-arm counter value and confirm it is indeed zero (If it’s not zero you have another problem…)
Next, you need to jump through a few hoops to delete the activation product key.
Use notepad to create a file which contains the following:
reg load HKLM\MY_SYSTEM “%~dp0Windows\System32\config\system” reg delete HKLM\MY_SYSTEM\WPA /f reg unload HKLM\MY_SYSTEM
Save it as a .bat file to the root of C: i.e. c:\rearm.bat
To run the .bat file you need to be in a recovery command prompt. To get there you need to:
- Reboot the server and after the BIOS screen press F8 to get to the advanced boot options.
- Select Repair Your Computer
- Enter the local administrator credentials when required and choose to open a command prompt.
(Alternatively, if you can’t see a Repair Your Computer option, boot from a 2008R2 DVD and choose the Repair your computer / Command Prompt options).
Next you need to find your .bat file – note C: drive may now be on the D: due to how the disks are mounted in recovery mode. Switch between disks and use the DIR command to find your .bat file.
Run your .bat file and then restart your computer. Your windows should now be in the activation grace period without a key and with the rearm count reset to 4.
If you use KMS licensing follow this Microsoft link for a guide on how to use slmgr to add the KMS key back into the registry using the command:
slmgr.vbs /ipk <KmsSetupKey>
I hope you find this one useful it certainly saved me a lot of effort as I didn’t need to rebuild multiple images just to add a few Windows updates!
6 thoughts on “How to reset the sysprep rearm counter on Windows 2008 R2”
On Server 2008 R2 I got no repair your computer option when booting and hitting F8.
I booted from a Server 2008 R2 DVD instead and chose Repair
Thanks Joshua, I’ve added a note above for this. 🙂
Is this syntax correct? reg load HKLM\MY_SYSTEM “%~dp0Windows\System32\config\system”
The %~dp0 variable in a Windows batch file will expand to the drive letter and path of that batch file.
i.e. it’ll use the windows system folder of the drive the batch file is run from.
Thanks for the quick response, I am able to get to the repair prompt but then when I find and run the batch file, I get this:
Error: Access is denied
I am logging in as local administrator.
I have given the batch file full control for everyone and still get the error, any ideas?
I would imagine it’s permissions on the registry causing the issue.