Getting Started with Windows PowerShell and VMM
Updated: May 13, 2016
Applies To: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager
All tasks in System Center 2012 – Virtual Machine Manager (VMM), even if initiated by using the VMM console, are performed by cmdlets. Therefore, you can accomplish any task in VMM by using the VMM command shell, or by combining the VMM cmdlets into a Windows PowerShell script.
If you are new to Windows PowerShell, see Windows PowerShell Basics in the Windows PowerShell User's Guide to help you get started.
For more information about getting started with Windows PowerShell, see the Windows PowerShell Getting Started Guide.
Whereas previous versions of VMM provided cmdlets in a snap-in, System Center 2012 – Virtual Machine Manager cmdlets are delivered in a Windows PowerShell module. Additionally, VMM cmdlets have been renamed for this version. Each cmdlet noun is now preceded with an "SC", including cmdlets that were included in previous versions of VMM. For example, in VMM 2008 R2, Get-VMHost retrieves a VMM host object. In System Center 2012 – Virtual Machine Manager, this cmdlet is now named Get-SCVMHost. Furthermore, several parameters that existed in previous versions of VMM have been renamed, and some parameters have been deprecated.
To assist you with transitioning your current scripts to the new naming convention, aliases have been added so that when you call a cmdlet by its previous name, the new version of the cmdlet runs. However, we strongly recommend that you review all cmdlets in order to discover any enhanced functionality introduced with expanded parameter sets. For more information about backward compatibility, see about_VMM_2012_Cmdlet_Backward_Compatibility.
For more information about working with Windows PowerShell modules, see about_Modules.
The VMM Windows PowerShell module is installed when you install the VMM console. For more information about installing the VMM console, see How to Install the VMM Console.
When you start the VMM command shell, a Windows PowerShell session opens, VMM loads the VMM module and establishes a connection to a VMM management server.
You can open the VMM command shell by using one of the following methods:
From any workspace in the VMM console, on the Home tab, in the Window group, click PowerShell.
On a computer on which the VMM console has been installed, click Start, click All Programs, click Microsoft System Center 2012, click Virtual Machine Manager, and then click Virtual Machine Manager Command Shell.
You can also import the VMM module into an existing Windows PowerShell session.
On a computer on which the VMM console has been installed, and the Windows PowerShell execution policy has been set to allow you to run scripts, type Import-Module -Name virtualmachinemanager at the Windows PowerShell command prompt. For information about setting the execution policy, type Get-Help Set-ExecutionPolicy.
Some computers may need to be restarted after installing the VMM console before Import-Module will import the VMM module into a Windows PowerShell session.