How to take VM snapshots using PowerCLI
search cancel

How to take VM snapshots using PowerCLI

book

Article ID: 418896

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides commands to take VM snapshots using PowerCLI commands.

Environment

VMware vSphere ESXi

Resolution

Connect to the vCenter Server

PS C:\> Connect-VIServer -Server vCenter-FQDN

Name                           Port  User
----                                ----    ----
vCenter-FQDN             443   VSPHERE.LOCAL\Administrator

 

1. Take snapshot of VM with memory :

Example:

PS C:\> Get-VM -Name "VM name" | New-Snapshot -Name "Test-1" -Description "test-snap" -Memory

Name                 Description                    PowerState
----                      -----------                         ----------
Test-1                 test-snap                       PoweredOn


2. Take snapshot of VM with quiesce :

Example:

PS C:\> Get-VM -Name "VM name" | New-Snapshot -Name "Test-2" -Description "test-snap" -Quiesce

Name                 Description                    PowerState
----                      -----------                         ----------
Test-2                 test-snap                       PoweredOff

 

3. Take snapshot without memory/quiesce :

Example:

PS C:\> Get-VM -Name "VM name" | New-Snapshot -Name "Test-3" -Description "test-snap"

Name                 Description                    PowerState
----                      -----------                         ----------
Test-3                 test-snap                       PoweredOff

 

To take multiple VM snapshots, you can specify multiple VM names separated by commas.

Example:

Get-VM -Name "VM name1","VM name2" | New-Snapshot -Name "Test-4" -Description "test-snap"