Sitemap

Member-only story

Awesome Hyper-V Cmdlets

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

Press enter or click to view image in full size

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

Figure 2

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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.