So, you screwed up your KMS licensing on your provisioned VMs?

So you booted your KMS-licensed VM and got a message about how your VM is a rogue copy of windows, or pirated, or some such, and you’re freaking out, aren’t you?  You issue slmgr /dlv and it says there is no installed product key, right?

First off, let me congratulate on you your rite of passage.  Secondly (in case the previous sentence didn’t clue you in to the fact), let me assure you that you aren’t the first one to do this.  Now, you’ve landed on this article because you typed something into Google looking for an article on how to fix it, didn’t you?  Fine, I won’t keep you hanging any longer.  Do this:

Power off all VMs using the affected vDisk image.
Switch the vDisk to Private Mode.
Click OK.
Open the properties on the vDisk again.
Change the licensing mode to “None”.
Power on your VM.
slmgr /ipk <kms product key>
slmgr /skms <fqdn to your KMS server – OPTIONAL – use if you need to specify a KMS server>
slmgr /ato
slmgr /upk
slmgr /ipk <kms product key>
slmgr /rearm

If you have Office installed, don’t forget to do ospprearm.exe, and if it’s a XenApp box, make sure to prepare for imaging and provisioning.  Then, shut the VM down.

Switch the vDisk back to Standard Mode and set your cache location.
Click OK.
Open the properties on the vDisk again.
Switch the licensing mode to KMS.
Bookmark this page for when you do it again <optional, but faster than Googling again>.