Automatic Virtual Machine Activation on Windows Server 2012 R2

Automatic Virtual Machine Activation (AVMA) acts as a proof-of-purchase mechanism, helping to ensure that Windows products are used in accordance with the Product Use Rights and Microsoft Software License Terms.

AVMA lets you install virtual machines on a properly activated Windows server without having to manage product keys for each individual virtual machine, even in disconnected environments. AVMA binds the virtual machine activation to the licensed virtualization server and activates the virtual machine when it starts up. AVMA also provides real-time reporting on usage and historical data on the license state of the virtual machine. Reporting and tracking data is available on the virtualization server.

Practical Applications

On virtualization servers that are activated using Volume Licensing or OEM licensing, AVMA offers several benefits.

Server datacenter managers can use AVMA to do the following:

· Activate virtual machines in remote locations

· Activate virtual machines with or without an internet connection

· Track virtual machine usage and licenses from the virtualization server, without requiring any access rights on the virtualized systems

There are no product keys to manage and no stickers on the servers to read. The virtual machine is activated and continues to work even when it is migrated across an array of virtualization servers.

Service Provider License Agreement (SPLA) partners and other hosting providers do not have to share product keys with tenants or access a tenant’s virtual machine to activate it. Virtual machine activation is transparent to the tenant when AVMA is used. Hosting providers can use the server logs to verify license compliance and to track client usage history.

System Requirements

AVMA only requires a virtualization server running Windows Server 2012 R2 Datacenter. The guest virtual machine operating system must be Windows Server 2012 R2 Datacenter, Windows Server 2012 R2 Standard, or Windows Server 2012 R2 Essentials.

How to implement AVMA

1. On a Windows Server 2012 R2 Datacenter virtualization server, install and configure the Microsoft Hyper-V Server role.

2. Create a virtual machine and install a supported server operating system on it.

3. Install the AVMA key in the virtual machine.

a. From an elevated command prompt, run the following command:

slmgr /ipk <AVMA_key>

The virtual machine will automatically activate the license against the virtualization server.

NOTE: You can also employ the AVMA keys in any unattended setup file.

Reporting and Tracking

The registry (KVP) on the virtualization server provides real-time tracking data for the guest operating systems. Because the registry key moves with the virtual machine, you can get license information as well. By default the KVP returns information about the virtual machine, including the following:

· Fully qualified domain name

· Operating system and service packs installed

· Processor architecture

· IPv4 an IPv6 network addresses

· RDP addresses

clip_image001NOTE: KVP data is not secured. It can be modified and is not monitored for changes.

clip_image001[1]IMPORTANT: KVP data should be removed if the AVMA key is replaced with another product key (retail, OEM, or volume licensing key).

Logs

Historical data about AVMA requests is available in a log file on the virtualization server (EventID 12310).

Since the AVMA activation process is transparent, error messages are not displayed. However, the following events are captured in a log file on the virtual machines (EventID 12309).

Notification

Description

AVMA Success

The virtual machine was activated.

Invalid Host

The virtualization server is unresponsive. This can happen when the server is not running a supported version of Windows.

Invalid Data

This usually results from a failure in communication between the virtualization server and the virtual machine, often caused by corruption, encryption, or data mismatch.

Activation Denied

The virtualization server could not activate the guest operating system because the AVMA ID did not match.

Cheers,


Marcos Nogueira
http://blog.marcosnogueira.org
Twitter: @mdnoga

Resizing a virtual hard disk with Windows Server 2012 R2

Starting in Windows Server 2012 R2 Preview, Hyper-V delivers the ability to expand or shrink the size of a virtual hard disk while the virtual machine is still running.

Storage administrators can avoid costly downtime by performing maintenance operations on running virtual hard disks. Shutting down virtual machines is no longer required and this eliminates interruption to users accessing those virtual machines and helps reduce maintenance costs. Prior to Windows Server 2012 R2 Preview, if a virtual machine was online or a virtual hard disk was in use, it was not possible to perform maintenance on the virtual hard disk without temporarily shutting down the virtual machine.

Requirements

The following functionality is required for resizing a virtual hard disk:

· A server capable of running Hyper-V. The server must have processor support for hardware virtualization. The Hyper-V role must be installed.

· A user account that is a member of the local Hyper-V Administrators group or the Administrators group.

The following functionality is required for resizing a virtual hard disk:

· VHDX – the ability to expand and shrink virtual hard disks is exclusive to virtual hard disks that are using the .vhdx file format. Online resizing is supported for VHDX disk types, including fixed, differencing, and dynamic disks. Virtual hard disks that use the .vhd file format are not supported for resizing operations.

· SCSI controller – the ability to expand or shrink the capacity of a virtual hard disk is exclusive to .vhdx files that are attached to a SCSI controller. VHDX files that are attached to an IDE controller are not supported.

Understanding online resizing functionality

There are important concepts to understand when increasing or decreasing the capacity of a virtual hard disk.

Expanding a virtual hard disk

Expanding a virtual hard disk increases the disk capacity of the virtual hard disk. However, to make the additional disk space available to the virtual machine requires some extra configuration. From the perspective of the virtual machine, the virtual hard disk expansion is reflected under Disk Manager as an unallocated disk volume. The size of this unallocated volume is the difference between the original virtual hard disk and the nominated size of the expanded virtual hard disk.

To make the full virtual hard disk capacity available to the virtual machine, you need to use Disk Manager to expand the volume within the virtual machine. You can do this by using the Extend Volume Wizard within Disk Manager. After this is complete, you will be able to view the expanded disk capacity in the operating system of the virtual machine.

Shrinking a virtual hard disk

As expected, when you shrink a virtual hard disk, the virtual hard disk capacity is decreased. However, there is a limit to amount of disk space that can be adjusted when you shrink a virtual hard disk. That limit is defined by the size of the volume that is currently in use by the virtual machine. The Hyper-V Manager user interface shows the minimum disk size available for shrinking a virtual hard disk.

If you want to shrink the size of the virtual hard disk below the size of the currently used volume within the virtual machine, you must first use Disk Manager in the operating system of the virtual machine to shrink the volume. After that is complete, you can reduce the size of the virtual hard disk.

Performing online resizing operations

In Windows Server 2012 R2, the option to resize a virtual hard disk is available through the Edit Virtual Hard Disk Wizard. However, the user interface option to shrink a virtual hard disk is only visible for virtual hard disks that have been previously expanded.

Administrators can use the Windows PowerShell interface for online virtual hard disk resizing operations. This can be done by using the Resize-VirtualDisk cmdlet.

Cheers,


Marcos Nogueira
http://blog.marcosnogueira.org
Twitter: @mdnoga

Enhanced Session Mode on Hyper-V 2012 R2

One of the new features or improved feature on Windows Server 2012 R2 is the enhanced session mode through virtual machine connection. Hyper-V and the Virtual Machine Connection tool now support redirection of local resources to a virtual machine session. This feature provides similar type of device redirection to a virtual machine as you get with a Remote Desktop Connection session.

Enhanced Session Mode

In previous versions of Hyper-V the Virtual Machine Connection utility only provided redirection of the virtual machine screen, keyboard, and mouse along with limited copy / paste functionality. To get additional redirection abilities a Remote Desktop Connection to the virtual machine could be initiated, but this would require a network path to the virtual machine.

Starting with Hyper-V in Windows Server 2012 R2 Preview, Hyper-V can now redirect local resources to a virtual machine session through Virtual Machine Connection tool. The enhanced session mode connection uses a Remote Desktop Connection session via the virtual machine bus (VMBus), so no network connection to the virtual machine is required.

The following local resources can be redirected when using the Virtual Machine Connection tool.

· Display configuration

· Audio

· Printers

· Clipboard

· Smart cards

· USB devices

· Drives

· Supported Plug and Play devices

This feature is enabled by default in Client Hyper-V and is disabled by default on Hyper-V running on Windows Server.

The following guest operating systems support enhanced session mode connections:

· Windows Server 2012 R2 Preview

· Windows 8.1 Preview

Practical applications

In previous versions of Hyper-V the way to copy files to and from a virtual machine was via a Remote Desktop Connection session or a network file copy, but these require a working network connection. When connecting to a virtual machine using the Virtual Machine Connection tool you could only copy and paste a limited amount of ASCII text to the virtual machine.

Enhanced session mode allows you to redirect local resources to the a virtual machine in the same way as you can with Remote Desktop Connection, but you do not need network connection to the virtual machine. You only need to be able to connect to the server running Hyper-V where the virtual machine is running.

Enhanced session mode can useful in the following scenarios:

· Troubleshooting a virtual machine without the need for a network connection to the virtual machine.

· Login to the virtual machine via smart card

· Printing from a virtual machine to a local printer

· Developers can now fully test and troubleshoot applications running in a virtual machine that require USB and sound redirection without the need to use Remote Desktop Connection.

Configuring Enhanced Session Mode

Configuration of enhanced session mode is done in the following areas:

· Server settings –Enhanced Session Mode Policy

· User setting –Enhanced Session Mode

· Guest operating system

Server settings – Enhanced Session Mode Policy

This setting affects all virtual machines running on the server running Hyper-V.

The Allow enhanced session mode setting will determine to allow or not allow enhanced session mode connections to virtual machines running on the server running Hyper-V. If this setting is enabled Hyper-V will allow enhanced session mode connections to a virtual machine when the following conditions are met:

· An enhanced session mode connection has been requested by the Virtual Machine Connection tool.

· The virtual machine is running an operating system which supports enhanced session mode.

· The Remote Desktop Service is running in the virtual machine.

When the Allow enhanced session mode setting is disabled, connections from the Virtual Machine Connection tool will use a basic session.

NOTE: The default setting for the Allow enhanced session mode is:

  • Hyper-V on Windows Server 2012 R2 Preview – Disabled
  • Client Hyper-V – Enabled

User settings – Enhanced Session Mode

This setting will determine if the Virtual Machine Connection tool will attempt to use enhanced session mode when available in a guest operating system. When Use enhanced session mode is enable device redirection will take place when the following conditions are met:

· Allow enhanced session mode is enabled on the server running Hyper-V.

· The virtual machine is running an operating system which supports enhanced session mode.

· The Remote Desktop Service is running in the virtual machine.

Guest operating system

The following is a list of the guest operating systems that support enhanced session mode connections.

· Windows Server 2012 R2 Preview

· Windows 8.1 Preview

Additionally the Remote Desktop Service needs to be running and the user account you be using to log on to the virtual machine needs to be a member of the Remote Desktop Users local group or the local Administrators group.

NOTE: Remote Desktop Services group policy and local group policy settings are enforced for enhanced session mode connections. So if there is a policy in effect that does not allow the redirection of printers, printer redirection in a Virtual Machine Connection session will be blocked as it would be for regular Remote Desktop Connection sessions.

Cheers,


Marcos Nogueira
http://blog.marcosnogueira.org
Twitter: @mdnoga