Starting and stopping virtual machines

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 virtual machines

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 of the preceding command is as follows:

Name                 PowerState Num CPUs MemoryGB
----                 ---------- -------- --------
VM2 PoweredOn 2 4.000 ...

Get Learning PowerCLI - Second Edition 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.