Change license key of Windows Server

Needed to install two Windows Server 2012 R2 instances today, but didn’t have a valid production license key yet and didn’t seem like there was a way to skip the key in the setup. Found you can remove a license key using a command, so worked around it using a temporary dev key from MSDN for the installation and then removed that key afterwards. For future self-reference, here’s how…

  1. Open elevated command prompt
  2. To remove key
    > slmgr -upk
  3. TO add new one
    > slmgr -ipk NEW-KEY or use regular activation process