Awesome Hyper-V Cmdlets

Maciej
5 min readJan 22, 2019

1. Get-VM

I’d have to say the one command used the most is Get-VM. It does exactly what its name implies as you can see in Figure 1.

Figure 1

Remember that what you are seeing are virtual machine objects and there is more than this default display.

Figure 2

As you can see, you can get virtual machines by name. Or you can filter on any of the virtual machine parameters. For example, I usually only want to see running virtual machines so I can use a command like this.

PS C:\> get-vm | where {$_.state -eq 'running'} | sort Uptime | select Name,Uptime,@{N="MemoryMB";E={$_.MemoryAssigned/1MB}},Status

I even went ahead and sorted on the Uptime property and formatted the assigned memory as MB. You can see the results in Figure 3.

Figure 3

2. Start-VM

Of course seeing a virtual machine is one thing. Controlling them is equally…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet