Pages

Thursday 16 February 2017

Taking multiple VMs snapshot – VMware vSphere PowerCLI

Or, How to create multiple VMs snapshot?
Or, How to take snapshot of multiple VMs at once?
Or, Command for taking multiple VMs snapshot.
Or, Taking snapshot of multiple VMs at once.

Descriptions: When you think of snapshot of virtual machines, its easy if you are doing it for one or two machines but its easiest when you thinking to do it for multiple VMs, may be 10-20 or more VMs. Yeah, correct, its was not a typo. J Its even easiest to take snapshot of multiple virtual machines.

The only thing you need is, VMware vSphere PowerCLI.

There are two methods that I use frequently for taking snapshot of multiple virtual machines:

1. Setting up $VMs parameter pointing to the list of virtual machines and then using New-Snapshot cmdlet
2. Typing VMs name manually and then using New-Snapshot cmdlet

Let’s see how?

Steps (Method-1): Setting up $VMs parameter pointing to the list of virtual machines and then using New-Snapshot cmdlet

Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

$VMs = Get-VM VM1, VM2, VM3, VM4


Note: replace VM1, VM2, VM3, and VM4 with your Virtual Machines name. You can add more VMs name here after coma (,).



Now, run the below command and hit enter to start the snapshot process:

New-Snapshot -VM $VMs -Name NameOfSnsphot -Description DescriptionOfSnapshot






That’s it, all VMs (VM1, VM2, VM3, and VM4), now would be having a snapshot.

Steps (Method-2): Typing VMs name manually and then using New-Snapshot cmdlet

Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

New-Snapshot -VM VM1, VM2, VM3, VM4 -Name NameOfSnsphot -Description DescriptionOfSnapshot

Note: replace VM1, VM2, VM3, and VM4 with your Virtual Machines name. You can add more VMs name here after coma (,).







Cheers, Please write me back if you have any query or feedback..

6 comments:

  1. Hi,

    Whenever I take a snapshot using PowerCLI 6.5, I'm always warned that:
    "WARNING: Parameter 'VM' is obsolete. This parameter no longer accepts multiple values."

    This happens even when I'm only passing in a single VM.
    It's not clear to me what the cmdlet wants if I'm not suppose to pass in a VM. Any ideas?

    Thanks,
    Joel
    jnewton@springcm.com

    ReplyDelete
  2. Hey Joel,

    Thanks for writing back.. First thing first, this is a warning not an error message, so it should be fine to ignore the warning and proceed with the command in this particular case.

    In my lab, I did not see any issue with this warning as the tasks I expected was completed successfully even after this warning message.

    Looks like its by design and may not be having any impact on this command/parameter's behaviour.

    Thanks

    ReplyDelete
  3. Thanks for the post, I have a quick question about VSphere's multivm snapshot, does it provide crash consistence or application consistence for the data across these VMs as captured in the snapshot?

    Data consistence becomes critical in case these VMs belong to one application.

    ReplyDelete
  4. Thanks for the post, I have a quick question about VSphere's multivm snapshot, does it provide crash consistence or application consistence for the data across these VMs as captured in the snapshot?

    Data consistence becomes critical in case these VMs belong to one application.

    ReplyDelete
    Replies
    1. Yes, It does. In other terms, Taking snapshot means, you have just created a restore point of the VM.

      But you should not use snapshot as a backup because snapshots are for troubleshooting and maintenance purpose like patching , configuration change testing etc..

      One Snapshot per VM is technically healthy and can guarantee the maximum efficiency of snapshot revert operation whenever needed.

      If you have multiple VMs for one application, its better to take snapshot of all VMs after shutting them down or by selecting QUIESCE Guest File System option for all of them while taking snapshot..

      If you still have any query, please feel free to write me back..

      Thanks

      Delete
  5. how to write without vitual machine's memory on poered on VM

    ReplyDelete