我有一个脚本,可以使用powershell
在远程服务器上启动新的HyperV VMNew-VM
Get-VM
我想在我的桌面上运行此脚本,但是我收到以下错误。
the term 'new-vm' is not recognized as the name of a cmdlet
我无法弄清楚如何在我的工作站上安装new-vm cmdlet
Get-WindowsFeature
the target of the specified cmdlet cannot be a windows client-based operating system
Install-windowsFeature hyperv-
the target of the specified cmdlet cannot be a windows client-based operating system
我对powershell很新,并且对Windows不做太多。
如何在Windows 8计算机上安装cmdlet New-VM
?
更新
还尝试了以下内容。
Enable-WindowsOptionalFeature -Online -FeatureName Hyper-V-Tools
Enable-WindowsOptionalFeature -Online -FeatureName Hyper-V-PowerShell
我在以下命令中看到了hyperv工具
Get-WindowsOptionalFeature -Online | sort state
Microsoft-Hyper-V
Microsoft-Hyper-V-Tools-All
Microsoft-Hyper-V-Management-Powershell
更新2
我几乎安装了它,但它出现了这个错误:
PS C:\Windows\system32> Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V-Management-Powershell
Enable-WindowsOptionalFeature : One or several parent features are disabled so current feature can not be enabled.
At line:1 char:1
+ Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V-Management- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand
PS C:\Windows\system32>
答案 0 :(得分:10)
安装好了。 powershell cmdlet具有可以通过添加-all
来安装的父项。
Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V-Management-Powershell -all
在cmdlet可用之前,您需要重新启动。