Using SCVMM 2012 Cmdlets in PowerShell

SCVMM Cmdlets allow SCVMM admin/users to do everything they can do in SCVMM AdminConsole in windows PowerShell command line. In SCVMM 2008 R2, you can run following command in PowerShell to run SCVMM cmdlets.

Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager

But this does not work in SCVMM 2012 as SCVMM 2012 uses PowerShell module. For SCVMM 2012 now you need run following in PowerShell instead

Import-Module "C:Program FilesMicrosoft System Center 2012Virtual Machine ManagerbinpsModulesvirtualmachinemanagervirtualmachinemanager"

(This assumes that you have SCVMM 2012 installed on the default location C:Program FilesMicrosoft System Center 2012 )

The PowerShell cmdlets in SCVMM 2012 change a lot in SCVMM 2012, you can get a list of all SCVMM 2012 cmdlets by typing the following at the PowerShell command shell prompt

Get-Command -Module virtualmachinemanager -Type cmdlet

And you can run Get-Help on any of the cmdlets to get the syntax for that cmdlet.

Get-Help <cmdlet name> -detailed

Update: Microsoft has published the SCVMM 2012 cmdlets help to TechNet, check it out http://technet.microsoft.com/en-us/library/hh801697.aspx


Comments

23 responses to “Using SCVMM 2012 Cmdlets in PowerShell”

Leave a Reply