在工作站上安装hyperv cmdlet

spu*_*der 4 powershell hyper-v

我有一个脚本,使用PowerShell在远程服务器上启动新的HyperV VM

New-VM
Get-VM
Run Code Online (Sandbox Code Playgroud)

我想在我的桌面上运行此脚本,但是我收到以下错误.

 the term 'new-vm' is not recognized as the name of a cmdlet
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何在我的工作站上安装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
Run Code Online (Sandbox Code Playgroud)

我对powershell很新,并且对Windows不做太多.

如何New-VM在Windows 8计算机上安装cmdlet ?

更新

还尝试了以下内容.

Enable-WindowsOptionalFeature -Online -FeatureName Hyper-V-Tools
Enable-WindowsOptionalFeature -Online -FeatureName Hyper-V-PowerShell
Run Code Online (Sandbox Code Playgroud)

我在以下命令中看到了hyperv工具

Get-WindowsOptionalFeature -Online | sort state
Microsoft-Hyper-V
Microsoft-Hyper-V-Tools-All
Microsoft-Hyper-V-Management-Powershell
Run Code Online (Sandbox Code Playgroud)

更新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>
Run Code Online (Sandbox Code Playgroud)

spu*_*der 10

安装好了.powershell cmdlet具有可以通过添加来安装的父项-all.

Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V-Management-Powershell -all
Run Code Online (Sandbox Code Playgroud)

在cmdlet可用之前,您需要重新启动.