Using PowerShell to start and stop Hyper-V virtual machines

PowerShell in the process of starting one of the VMs on this machine

I've been doing a bit of VM Host upgrading recently and being able to mainpulate VMs on said hosts via the command line makes things go a lot quicker! Here's two PowerShell commands I've executed more times than I'd care to mention over the past few days:

Get-VM | Start-VM

Get-VM | Save-VM

The first command iterates over all VMs on the current machine (or another one if you've used Enter-PSSession to remote to another machine) and, well, starts them. The second command iterates over all VMs and saves them to disk - effectively hibernating them so you can bring them back up quickly once whatever VM Host upgrading task you're going through has been completed.

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments

Add a Comment