PowerCLI

 View Only
  • 1.  Multiple vm snapshot creation and deletion

    Posted Jan 19, 2017 08:50 PM

    HI,

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

    please provide if someone have this script.



  • 2.  RE: Multiple vm snapshot creation and deletion

    Posted Jan 20, 2017 03:50 PM

    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.



  • 3.  RE: Multiple vm snapshot creation and deletion

    Posted Feb 23, 2017 06:05 AM

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

    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



  • 4.  RE: Multiple vm snapshot creation and deletion

    Posted Mar 13, 2017 04:49 PM

    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



  • 5.  RE: Multiple vm snapshot creation and deletion

    Posted Mar 13, 2017 04:51 PM

    Discussion moved from VMware ESXi 6 to VMware PowerCLI



  • 6.  RE: Multiple vm snapshot creation and deletion

    Posted Aug 01, 2022 01:45 AM

    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