WAP – Deploying a VM Role, some VM’s prompt for product key

Simple one that new WAP users often miss when deploying VHD’s for VM Roles.

When deploying a VM role with multiple instances, some instances get stuck during deployment with the VM waiting for a product key to be entered.

server-key

Although the solution is clearly discussed here on TechNet I find that new WAP admins typically overlook this setting when importing a new vhd/vhdx template and loose a bit of time troubleshooting.

 

Some things to note with the below PowerShell script:

  • I like variables and repeatable scripts but beware, the below will change/set the key for all vhd’s in your library matching the OS defined
  • I am using the AVMA key found here on TechNet. You may have to adjust this according to your tenant licensing method.

 

Now, the script….

$VHD = Get-SCVirtualHarddisk | where {$_.OperatingSystem -eq  "Windows Server 2012 R2 Datacenter"}
Set-SCVirtualHarddisk –virtualharddisk $VHD –ProductKey Y4TGP-NPTV9-HTC2H-7MGQ3-DV4TW

 

Yep, that’s it!!

Enjoy
Dan