Using VMM sample scripts

The sample scripts in this recipe illustrate how to use Windows PowerShell for centralized management.

You can use VMM PowerShell cmdlets to automate VMM tasks by executing them from a machine that has the VMM console installed.

The following section contains some samples to add storage and convert the VHD disk format to the VHDX disk format.

How to do it...

You can use PowerShell scripts to automate various tasks. The following section will help you with the sample script that counts the number of Virtual Machines per Operating System (VMs per OS).

Counting the number of Virtual Machines per Operating System

The following script will count the VMs per OS:

Import-Module virtualmachinemanager
$vHosts = Get-SCVMHost
foreach ($vHost ...

Get System Center 2012 R2 Virtual Machine Manager Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.