Starting and stopping a virtual machine

You have created your virtual machine but it is still powered off. In this section, you will learn how to start, suspend, and stop a virtual machine using PowerCLI.

Starting a virtual machine

To start a virtual machine, you can use the Start-VM cmdlet. This cmdlet has the following syntax:

Start-VM [-RunAsync] [-VM] <VirtualMachine[]> [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

The –VM parameter is required to start a virtual machine.

In the first example, we will start the virtual machine VM2 using the following command:

PowerCLI C:\> Start-VM –VM VM2

The output to the preceding command is as follows:

Name                 PowerState Num CPUs MemoryGB
----                 ---------- -------- --------
VM2 PoweredOn 1 1.000 ...

Get Learning PowerCLI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.