Question:
I have a script that starts new HyperV VM’s on a remote server using powershell
1 2 3 |
New-VM Get-VM |
I want to run this script on my desktop, however I get the following error.
1 2 |
the term 'new-vm' is not recognized as the name of a cmdlet |
I can’t figure out how to install the new-vm cmdlet on my workstation
1 2 3 4 5 6 |
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 |
I am very new to powershell, and don’t do much with windows.
How can I install the cmdlet New-VM
on a Windows 8 machine?
Update
Also tried the following.
1 2 3 |
Enable-WindowsOptionalFeature -Online -FeatureName Hyper-V-Tools Enable-WindowsOptionalFeature -Online -FeatureName Hyper-V-PowerShell |
I see hyperv tools in the following command
1 2 3 4 5 |
Get-WindowsOptionalFeature -Online | sort state Microsoft-Hyper-V Microsoft-Hyper-V-Tools-All Microsoft-Hyper-V-Management-Powershell |
Update 2
I almost got it installed, but it gives this error:
1 2 3 4 5 6 7 8 9 10 |
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> |
Answer:
Got it installed. The powershell cmdlet has parents that can be installed by adding -all
.
1 2 |
Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V-Management-Powershell -all |
You will need to reboot before the cmdlet is available.