How To Automatic Activate Windows Server 2012 R2 Virtual Machines via PowerShell? #HyperV #PowerShell

Hello folks,

Automatic Virtual Machine Activation! is pretty cool feature…

Automatic Virtual Machine Activation (AVMA) is a feature that was introduced in Windows Server 2012 R2. AVMA binds the virtual machine activation to the licensed virtualization server and activates the virtual machine when it starts up. This eliminates the need to enter licensing information and activate each virtual machine individually.

In order to get benefits of this feature, AVMA requires that the host is running Windows Server 2012 R2 Datacenter and that the guest virtual machine OS is either Windows Server 2012 R2 Datacenter, Windows Server 2012 R2 Standard or Windows Server 2012 R2 Essentials.

How to:
This is a one step process. Once the Hyper-V host (Windows Server 2012 R2 Datacenter) is activated and guest virtual machines are running smoothly (without activation of course!), the only remaining step is to install the AVMA client key on the guest virtual machines (Data Center, Standard or Essentials). To manually install the key using Command line use the following Syntax from an administrative Command prompt inside the guest OS:

C:\>slmgr.vbs /ipk AVMA Key

Where the generic AVMA Key is selected according to the Guest OS Edition, more information here.


The whole activation process does not require any network connection of any sort between the Hyper-V host and the guest OS.

This is how the manual approach to activate Windows Server 2012 R2 VM.

You have deployed several virtual machines from a template without SCVMM or deployment tool such as MDT where you can inject above process during the deployment, and now you want to activate all VMs.

Of course you could use the manual approach above, but the easiest way is to use PowerShell, I have created a small script that takes care of all the steps for you:

Here we go:

First we need to check what is the License Status of all Virtual Machines? you can run the following cmdlet to get all VMs on a single host:


We found out that all virtual machines are not activated yet!

So let’s activate them automatically using PowerShell combined with Hyper-V Guest Services feature Winking smile

Finally, let’s check again what is the License Status of all Virtual Machines.


Sure enough there are different ways to accomplish the same result, but nevertheless it has worked for me and I feel that it’s a much easier than having to activate each VM manually.

Enjoy your day!


About Charbel Nemnom 405 Articles
Charbel Nemnom is a Cloud Solutions Architect and Microsoft Most Valuable Professional (MVP), totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 17 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

Be the first to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.