Windows 2012 R2 offline activation
Problem
I was at a site, the server I was working on was in on a closed network with no internet access. But I had to activate the Windows Server 2012 R2. I entered the key but got an error that the key is invalid.
You key is most likely not invalid. In Windows Server 2012 R2 the behavior is a little different, when you activate the product key you are simply told that it is an invalid key. The server is trying to validate the key over the internet, which of course doesn't work if your server doesn't have a path out.
Solution
To solve this issue open command prompt and enter the first command. You will get a message stating your Activation Key has been entered successfully. Then use the second command and this will bring up the UI, similar to previous Windows versions, that will walk you through phone activation.
Command 1 - slmgr -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (where "X" is your product key)
Command 2 - slui 4
Keep on keeping on...