【问题标题】:Install hyperv cmdlet on workstation在工作站上安装 hyperv cmdlet
【发布时间】:2015-04-28 21:36:16
【问题描述】:

我有一个使用 powershell 在远程服务器上启动新 HyperV 虚拟机的脚本

New-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>

【问题讨论】:

    标签: powershell hyper-v


    【解决方案1】:

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

    Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V-Management-Powershell -all
    

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

    【讨论】:

      猜你喜欢
      • 2016-04-05
      • 1970-01-01
      • 2020-06-12
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多