Opvizor

Snapshot Management with Power CLI

Command to list the  properties of snapshot  using  power cli

get-vm | get-snapshot | format-list

Description
Created
Quiesced
PowerState
VM
VMId
Parent
ParentSnapshotId
ParentSnapshot
Children
SizeMB
IsCurrent
IsReplaySupported
ExtensionData
Id
Name
Uid

Generate complete snapshot inventory with few details

       get-vm | Get-Snapshot

Export complete snapshot inventory to csv file

get-vm | get-snapshot | format-list | Export-Csv C:\snaps.csv

Generate snapshot information inside folder  

   get-vm -location “VMWARE-Administration” | get-snapshot

Generate snapshot information with specific Description

get-vm | get-snapshot  | where {$_.Description -match “Avamar Snapshot generated for back” }    ->

Generate snapshot information with specific Description and formatted mode

get-vm | get-snapshot  | where {$_.Description -match “Avamar Snapshot generated for back”}| Format-Table -Property VM,Name,Created,Description, SizeMB


Create new snapshot with description and name

get-vm TEST-VM-01 |New-Snapshot -name snspshottest -Description  snapshottest

Get snapshot information about specific VM      

get-vm TEST-VM-01 | Get-Snapshot

Remove snapshot of a specific VM

get-vm TEST-VM-01 |Get-Snapshot |Remove-Snapshot    ( It will ask to confirm to perform snapshot removal )

get-vm TEST-VM-01 |Get-Snapshot |Remove-Snapshot  -Confirm:$false


Remove Snapshot By Description

get-vm | get-snapshot  | where {$_.Description -match “Avamar Snapshot generated for back”}| Remove-Snapshot -Confirm:$false -RunAsync

List snapshot created prior to “X” days

Get-VM | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-130)}
Get-VM | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-60)}

Get-VM | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-60)} | Select-Object VM, Name, Created, SizeMB

Get-VM | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(1)} | Select-Object VM, Name, Created, SizeMB

Rajesh Radhakrishnan

Share
Published by
Rajesh Radhakrishnan

Recent Posts

NAKIVO Backup & Replication v10.8 Released With New Features

Nakivo has released its new Backup and Replication solution Nakivo v10.8, which includes support for…

2 years ago

Oracle Cloud VMware Solution and Features

Oracle Cloud VMware Solution (OCVS) provides a customer-managed, native VMware-based cloud environment hosted in Oracle…

2 years ago

Vinchin Backup and Recovery Review

Vinchin is a professional provider of data protection solutions for enterprises. It provides a series…

2 years ago

VMware Cloud Disaster Recovery (VCDR) Solution Deployment And Configuration Part 2

In my previous blog post, I have explained about VMware Cloud Disaster Recovery (VCDR) Onboarding and…

2 years ago

How to Deploy vRNI Cloud With VMC on AWS

vRealize Network Insight helps you build an optimized, highly available, and secure network infrastructure across…

2 years ago

This SysAdmin Day, WIN with Hornetsecurity!

Can you believe it's here again? SysAdmin Day is back, and with it comes endless gratitude…

2 years ago