Try Now

Hyper-V PowerShell Module

The Hyper-V Module is a bundle of commandlets for creating and administrating virtual machines in Microsoft Hyper-V with PowerShell.

What is the Hyper-V PowerShell module?

Hyper-V PowerShell module is a bundle of commandlets for creating, configuring and managing virtual machines in Microsoft Hyper-V.

Managing VMs and Hyper-V hosts with PowerShell offers several advantages over using graphical interfaces (such as Virtual Machine Manager or Windows Admin Center).

Using the command line not only saves you time by avoiding long click sequences, but you can also automate operations such as creating, configuring and deleting VMs.

And most importantly, certain tasks, like creating more than one virtual adapter for the management operating system can only be configured by PowerShell, as well as Hyper-V’s networking Quality of Service.

The Hyper-V module must be installed separately on a machine, even if Hyper-V is already enabled. Before you get started, check the requirements down below, as the Hyper-V role can not be installed on Windows 10 Home e.g.

Installing the Hyper-V PowerShell Module

Installation with Hyper-V

First a note: As Microsoft notes in its documentation, Hyper-V is already built into Windows as an optional feature. Therefore, there is no Hyper-V download per se. But, since it’s optional, you might have to enable it before you can use it.

If Hyper-V isn’t yet enabled on your machine, you can simply install the PowerShell module in the same step. For this purpose, run the following command in PowerShell:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

Separate Installation of the Hyper-V PowerShell Module

If you just want to install the Hyper-V PowerShell Module itself, run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell

Hyper-V PowerShell Commandlets

Display all available Hyper-V PowerShell Commandlets

In the usual PowerShell way, you can use Get-Command with the parameter „Hyper-V“  to display all commands of the Hyper-V module in PowerShell:

Get-Command -Module "Hyper-V"

Overview Hyper-V PowerShell Commandlets

Visit the Microsoft Documentation for the Hyper-V Module for a list of all Commandlets from the Hyper-V PowerShell Module as well as explanations of function and syntax.

 

12 tips for managing Hyper-V with PowerShell and Windows Admin Center

Visit our blog for more detailed tutorials on how to install, configure and manage Hyper-V with PowerShell as well as common tools like Windows Admin Center and Virtual Machine Manager.

Learn more >

scriptrunner-blog-verwaltung-hyper-v_Zeichenfläche 1