How to windows activate server 2012 VM

I have a Windows Server 2012 R2 Standard running as a hypervisor. Which then has one guest VM running Server 2012 R2 Standard. I have now created a second VM, also running Server 2012 R2 Standard.

I used a iso from my vlc. I know that the host OS licence covers the two guest VMs too.

The new VM will not activate, When I click to activate I get ask for a licence key. I didnt install hyper V server myself and dont have any licence key documentation.

How can I get this machine activated?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cliff GaliherCommented:
If you have a volume license, the key is in the VL portal. While a standard license does indeed cover two VMs, you still need to use keys in the portal to activate the VMs. The host does not do so automatically on standard.
roy_battyDirectorAuthor Commented:
OK I only used the VLSC to download the media. The key I have is for someone else.

So I used this 

to get the licence key used on the hyper-v server. When I tried to use that on teh new VM it says that it didnt work.

Any suggestions?
Cliff GaliherCommented:
If you have legal licenses  you have legal keys documented somewhere. Nobody here can tell you where that is. And I don't recommend using key extracters or other random keys. That's legally and ethically pretty much a stretch for me. My only advice is find your legally issued key(s.)

I don't even recommend using VL media to install the OS if it is an OEM license. That's called reimaging and is also illegal  as that is not an OEM right.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

automated activation works only on host having datacenter editions

Still with standard edition you are entitled to run two VMs for free
with below powershell find out product key for your host server

(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

Open in new window

after that try to use same key on VMs and see if it gets activated
if not try below process:
on VM with elevated command prompt:
slmgr /upk <press enter> --------wait to uninstall existing key
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX <press enter> ----------wait to install new key
for last step you should have internet:
slmgr /ato <press enter> to activate windows with MS clearing house
you may use below code and save it in vbs extension and run on host server to find out key
run it from elevated command prompt
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Cur = 0
x = 14
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function

Open in new window

original source:
roy_battyDirectorAuthor Commented:
OK done that. Mahesh's script gave me same key I had found myself earlier.

Tried using this key via the Slmgr commands mentioned above. I get as far as applying the code and it fails with an error 0XC004F050 The software licensing service reported that the product key is invalid.

Is this happening because I used volume licence media to install the VM when originally the hyper-v host server was an OEM licence?
Then try to activate host with OEM key
Replace VL key with OEM and then try same procedure with guest VMs
roy_battyDirectorAuthor Commented:
OK when I run Mahesh's script aboce I get a licence key, when I try and use that key on the new VM it fails with an error of Invalid Key.

I then decided to try Magic JellyBean Keyfinder on the Host Hyper-V server. Jellybean gives me a completely different key. When I use this key it activates fine.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
roy_battyDirectorAuthor Commented:
My solution is what actually worked in the end
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.