使用powershell安装vm需要先下载hyper module,从http://pshyperv.codeplex.com/下载,下载以后解压把HyperV文件夹拷贝到c:\windows\system32\windowspowershell\modules\下,把进入PsHyperV文件夹,右键管理员运行install,安装以后运行Get-Command -Module hyperv可以看到相关命令都有了

Windows 2008 R2 安裝 PowerShell management Library for Hyper-V_powershell

通过get-module -listavailable查看可以使用的模块,通过import-module 导入模块。

在vmm上导入vm模块:

Import-Module "C:\Program Files\Microsoft System Center 2012\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager"