Weighing Hyper-V R2 task automation options

Weighing Hyper-V R2 task automation options

Solutions provider takeaway: Hyper-V R2's built-in task automation may suffice for simple tasks, but it's too limited for more complex ones. Solutions providers should help customers evaluate Hyper-V task management options -- from System Center Virtual Machine Manager to freeware alternatives -- and educate customers on each option's pricing and support-level tradeoffs.

Microsoft Hyper-V R2 can be a smart move for a cash-strapped customer that wants to virtualize its environment. But as you may know, free technologies come with limitations.

To continue reading for free, register below or login

Requires Membership to View

To gain access to this and all member only content, please provide the following information:

By submitting your registration information to SearchSystemsChannel.com you agree to receive email communications from the TechTarget network of sites, and/or third party content providers that have relationships with TechTarget, based on your topic interests and activity, including updates on new content, event notifications, new site launches and market research surveys. Please verify all information and selections above. You may unsubscribe at any time from one or more of the services you have selected by editing your profile, unsubscribing via email or by contacting us here

  • Your use of SearchSystemsChannel.com is governed by our Terms of Use
  • We designed our Privacy Policy to provide you with important disclosures about how we collect and use your registration and other information. We encourage you to read the Privacy Policy, and to use it to help make informed decisions.
  • If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States.

More on Hyper-V R2

Third-party tools for Microsoft Hyper-V R2: Top 5 must-haves

Most useful Windows Server 2008 R2 and Hyper-V R2 features

Three setbacks when designing Hyper-V R2 High Availability

Hyper-V R2 features: Top 10 resources

Hyper-V's built-in task automation is a perfect example. Solutions providers can manage Hyper-V R2 alone in Windows Server 2008 R2 with the PowerShell command line. But Hyper-V's singular PowerShell capabilities are complex at best and limiting at worst.

PowerShell is designed as a command-line solution in which well-formed cmdlets can automate simple tasks. A well-formed cmdlet can power on a virtual machine with a few keywords on a single line. But Hyper-V doesn't come with a set of well-formed cmdlets out of the box, so task automation in Windows Server 2008 R2 is limited. Instead, Hyper-V's native PowerShell leans on Windows Management Instrumentation (WMI) to get the job done.

So, while solutions providers can use WMI to automate the types of virtual machine (VM) tasks that customers want, using WMI for what should be a single-line command for a simple task requires extra effort.

As customer, for example, that is familiar with PowerShell might expect a single cmdlet for listing the checkpoints (also called "snapshots") that are attached to every VM on the Hyper-V host. Such a command might look like the following:

Get-VMCheckpoint –VMMServer server1.contoso.com

This isn't as simple as it looks, though, because the command doesn't work with Hyper-V alone. Getting this information out of Hyper-V requires you to type a variation of this command:

$VM = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='VmToSnapshot'"

Get-WmiObject -Namespace root\virtualization -Query "Associators Of {$VM} Where AssocClass=Msvm_ElementSettingData ResultClass=Msvm_VirtualSystemSettingData" | Format-List -Property ElementName, InstanceID

The complicated nature of the second command prompts many Windows administrators steering clear of PowerShell command line task automation for Hyper-V.

Simplifying task automation in Hyper-V R2

Solutions providers have a few options to make Hyper-V commands less complex. System Center Virtual Machine Manager (SCVMM) is intended to be the management layer for Hyper-V and is an absolute must for environments where customers have many Hyper-V hosts that operate together. SCVMM provides the simple cmdlets that Hyper-V lacks on its own.

You can run the first command above on a server where SCVMM is installed or from a desktop computer where the SCVMM administrative tools have been installed. Running the first command there will produce the desired result because Hyper-V is no longer acting singularly.

While Hyper-V involves no extra cost above and beyond the Windows Server 2008 R2 license, you should make customers aware that SCVMM requires additional licensing. Even with the added cost, SCVMM's command line automation and other features makes it an easy sell when developing specifications for customers.

Customers that don't want the added cost of SCVMM have other options. The PowerShell Management Library for Hyper-V is an open source project by Microsoft's James O'Neill and a freeware alternative to SCVMM's PowerShell cmdlet set. Keep in mind that because it is open source, it doesn't come with the same levels of support available from SCVMM. But installing its PowerShell module to an available Hyper-V machine or desktop computer provides a combination of 31 different verbs and 69 nouns for streamlining command line automation.

In some cases, cmdlets in the PowerShell Management Library for Hyper-V can provide greater functionality than does SCVMM. Snapshots, for example, can be viewed and manipulated by using at least eight different cmdlets in the library. These eight cmdlets perform the following functions:

  • Get-VMsnapshot: Returns snapshots for one or more VM(s).
  • Get-VMsnapshottree: Displays all the snapshots of a VM in a tree view.
  • Select-VMsnapshot: Allows the user to select a snapshot for a VM.
  • New-VMsnapshot: Creates a new snapshot of one more VMs.
  • Rename-VMsnapshot: Changes the display name of a snapshot.
  • Update-VMSnapshot: Replaces an existing snapshot with a new one.
  • Restore-VMsnapshot: Rolls a VM back (or forward) to a snapshot.
  • Remove-VMSnapshot: Removes one or more snapshots from a VM.

For solutions providers that deal with multiple Hyper-V tasks -- particularly for customers with large environments -- task automation is a necessity. Ensuring that customers have the proper management capabilities at their fingertips is an important step as you guide customers through a Hyper-V purchase.

About the author
Greg Shields, MVP, vExpert, is a partner with Concentrated Technology. Get more of Greg's tips and tricks at http://concentratedtech.com/.

This was first published in August 2010

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.