Email this to a friend
posted on September 9th 2019, at 12:45
by lunarg
Handling snapshots (creating, deleting, restoring) is rather intuitive when you already have some experience with PowerCLI. As a reference, here are some one-liners. As always with Powershell, there's more than one way to achieve a goal... The examples used here assume a VM named "SRV01". Adjust as needed.

Create a snapshot:

Get-VM SRV01 | New-Snapshot -Name "My snapshot"

Remove all snapshots (disabling confirmation request in the process):

Get-VM SRV01 | Get-Snapshot | Remove-Snapshot -Confirm:$false

To handle a specific snapshot, you could do something like this:

$vm = Get-VM SRV01$snap = Get-Snapshot -VM $vm -Name "My snapshot"# do something with the sn  ...

Send a link to this post to yourself or a friend.

Send to e-mail:
Your name:
Your e-mail:
Type the letters and numbers as shown.
Not readable? Get another.
Information entered is solely used for sending a one-time e-mail, and is not retained and/or passed on to a third party.
« March 2021»
« You only find out who is swimming naked when the tide goes out. »
Warren Buffett