[Quick Introduction] PowerShell Get-VM Details Hyper-V

Microsoft provide a great tool PowerShell to automate multiple tasks, including virtual machines. In this article, I will introduce a common PowerShell command, Get-VM to retrieve the VM details on Hyper-V.

Crystal

By Crystal / Updated on March 8, 2023

Share this: instagram reddit

What is Microsoft PowerShell

If you are getting tired with massive repetitive tasks, you may be inclined to save your time by automating them. Microsoft offers a scripting language, PowerShell, that can help.

PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. It can be run on Windows, Linux, and macOS.

PowerShell logo

In PowerShell, administrative tasks are generally performed via cmdlets, which are specialized .NET classes implementing a particular operation.

Hyper-V is a widely used type-1 hypervisor. In this article, I will introduce one very common cmdlets of PowerShell Get-VM details Hyper-V VMs. Before you start, you need to install Hyper-V PowerShell cmdlets in advance.

Installing Hyper-V PowerShell cmdlets

In this part, I will introduce how to install Hyper-V PowerShell cmdlets. If you already know the steps or installed the module, you can skip this part.

Take Windows 10 as an example, you can install Hyper-V PowerShell module via Windows 10 Control Panel GUI or PowerShell commands.

How to install Hyper-V PowerShell module via Windows 10 Control Panel GUI

1. Open Programs and Features in the Start menu or Settings > Apps.

Programs and Features

2. Click Turn Windows features on or off on the pop-up window.

Turn Windows features on or off

3. In Windows Features, expand Hyper-V > Hyper-V Management Tools and you can check the Hyper-V Module for Windows PowerShell option. Click OK to save.

Add Hyper-V PowerShell module on Windows 10

How to install Hyper-V PowerShell module via PowerShell commands

Install only Hyper-V PowerShell module

Launch Windows PowerShell, and run the following commands to install the Hyper-V PowerShell module only:

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

Enable Hyper-V PowerShell module on Win 10

Install Hyper-V with Hyper-V PowerShell module

Launch Windows PowerShell, and run the following commands to install Hyper-V and Hyper-V PowerShell module in one same step:

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

Enable Hyper-V All

PowerShell Get-VM details Hyper-V

Get-VM is a very common cmdlet, it is used to get list of VMs on host PowerShell, and retrieve the detail information of virtual machines from one or more Hyper-V hosts. There are three Get-VM lines of syntax:

Get-VM [[-Name] ] [-ComputerName ] []

Get-VM [-ClusterObject] []

Get-VM [[-Id] ] [-ComputerName ] []

As you can see, there are three different parameter sets, you can run Get-VM without any parameters and just choose its default parameter, but you cannot mix parameters from one set with parameters in another.

For example, run only the Get-VM cmdlet, PowerShell will display a table showing all of your VMs on the local Hyper-V host, and the State, CPU Usage, Memory Assigned, Uptime, Status and Version of each of your VMs.

Tip: Using the | fl pipe, you can see a little more information including the Memory Demand, Memory Status, VM generation, and Replication State.

Get-VM | fl

But as you can see, the information retrieved is still limited. If you need to see more detailed information about a specific VM, all you have to do is specify the name of the VM and append the Select-Object cmdlet, along with an asterisk, which indicates that you want to see all of the available information for that VM.

Get-VM | Select-Object *

As for more complicated tasks, for example, VM backups, you may need PowerShell script to complete them. Although convenient, it is not friendly to people who are not familiar with PowerShell, and may cause many errors.

Automate Hyper-V VM backup using AOMEI Cyber Backup (free)

Using PowerShell scripts to backup Hyper-V VMs is not easy. Therefore, to be more efficient, administrators tend to select a backup software to automate the VM backup.

Here I introduce you to a free Hyper-V backup software -- AOMEI Cyber Backup. It offers you the following benefits.

Agentless Backup: create complete and independent image-level backup for VMware ESXi and Hyper-V VMs.
Multiple Storage Destinations: backup to local or network share destinations.
Automated Execution: automate daily, weekly, or monthly backups and notified by email.
Perpetual Free: you can use AOMEI Cyber Backup Free Edition with no time limit.

AOMEI Cyber Backup supports Hyper-V in Windows 8/8.1/10/11, Windows Server/Microsoft Hyper-V Server 2012 R2 and later versions.

Next, I will show you how to backup Hyper-V VMs with AOMEI Cyber Backup in 3 simple steps. You can click the following button to download the freeware.

Download FreewareVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

How to backup and restore Hyper-V VMs (3 easy steps)

1. Bind Devices: Access to AOMEI Cyber Backup web client, navigate to Source Device > Hyper-V > + Add Hyper-V to add a Hyper-V host. And then click > Bind Device.

Add Hyper-V Host

2. Create Backup Task: Navigate to Backup Task > + Create New Task, and then set Task Name, Backup Type, Device, Target, and Schedule.

  • Device: cover multiple VMs on the host in one backup task.
  • Target: select to back up to a local path, or to a network path.
  • Schedule: choose to perform full, differential or incremental backup, and automate execution according to the frequency you specified.

Schedule Hyper-V VM Backup

3. Run Backup: Click Start Backup and select Add the schedule and start backup now, or Add the schedule only.

Start Backup

4. Restore VM: Click > Restore on the backup task to open a wizard, and click Select Content to specify a restore point. Select to Restore to original location, and click Start Restore.

Restore Hyper-V VM

Summary

Microsoft PowerShell is an efficient tool to automate multiple tasks. In this article, I introduced a common cmdlet of PowerShell Get-VM details Hyper-V. It can be used for PowerShell list Hyper-V VMs and their information.

However, using PowerShell script to perform complex tasks, such as virtual machine backup, may be not friendly enough to people who are not familiar with PowerShell commands. You can try AOMEI Cyber Backup for free.

Crystal
Crystal · Editor
Crystal is an editor from AOMEI Technology. She mainly writes articles about virtual machine. She is a positive young lady likes to share articles with peolpe. Off work she loves travelling and cooking which is wonderful for life.