vmwARE-NEW
Contributor
Contributor

Multiple vm snapshot creation and deletion

HI,

I'm looking for simple powercli script to create and delete list of vms snapshots.

please provide if someone have this script.

Tags (1)
Reply
0 Kudos
jpsider
Expert
Expert

Do you have any powercli/powershell experience?

Here is a link to the cmdlet reference :

vSphere 6.0 Documentation Center

I suggest coming up with some pseudo code first, and we can then help you with the final details.

Reply
0 Kudos
iamamit
Enthusiast
Enthusiast

The Good news for you is, there is no high level scripting is required to achieve what you want.. Smiley Happy

Here are some cool and easy to operate stuff about multiple VMs snapshot creation..

http://www.techiessphere.com/2017/02/taking-multiple-vms-snapshot-vmware.html

http://www.techiessphere.com/2017/02/multiple-virtual-machines-snapshot-import-csv.html

To delete the VMs, you may use below command on POwerCLI:

get-vm | Get-Snapshot | where {$_.name -match "newsnapshotclitest"}| Remove-Snapshot

(This command will delete all snapshot matching the name "newsnapshotclitest" from all VMs, so use it carefully after understanding it well and testing it on test environment first).

Thanks,

Amit

Reply
0 Kudos
iamamit
Enthusiast
Enthusiast

in addition to my reply above, I would recommend to read the below KB for snapshot removal task.. Its explained in detail..

http://www.techiessphere.com/2017/03/removing-snapshot-of-multiple-virtual-machines-vmware.html

Thanks,

Amit

Reply
0 Kudos
a_p_
Leadership
Leadership

Discussion moved from VMware ESXi 6 to VMware PowerCLI

Reply
0 Kudos
Sam0054
Enthusiast
Enthusiast

Hi there,

Please try use this commands, it worked for me.

To get snapshots for multiple VMs use this:

Get-VM -Name VM1,VM2,VM3 | New-Snapshot -Name SnapshotNameHere - Description SnapshotDescriptionHere

To delete snapshot for multiple VMs use this

G-VM -Name VM1,VM2,VM3, | Get-Snapshot | Remove-Snapshot

 

Note: reference VM1,VM2,VM3 to your VMs
Hope that helps

Reply
0 Kudos