Automation

 View Only
  • 1.  Automated Revert vCenter Snapshot and Poweron

    Posted Jul 30, 2023 03:21 PM

    I'm looking to revert vCenter from a snapshot, but as you might know this will disconnect you from the PowerCLI session.  I'd like to try and revert the snapshot and disconnect quickly so that the session doesn't hang so that I can execute the rest of the steps (3-7).  Any ideas?  Mainly looking for getting around the session hang and figuring out the probe vCenter readiness.

    High level flow:

    1. Migrate vCenter to first host of cluster.
    2. Revert vCenter from snapshot.
    3. Disconnect from vCenter.
    4. Connect to first host.
    5. Power on vCenter.
    6. Probe vCenter to be back online
    7. Connect to vCenter.


  • 2.  RE: Automated Revert vCenter Snapshot and Poweron

    Posted Jul 30, 2023 04:25 PM

    I often schedule this kind of task (either via the Windows Task Scheduler or via a cron job).
    Schedule the jobs a couple of seconds in the future, then in your original script disconnect from your vCenter.

    Make sure in step 5 to check if the snapshot revert is completed without errors.



  • 3.  RE: Automated Revert vCenter Snapshot and Poweron

    Posted Aug 02, 2023 09:07 PM

    Update:  I haven't spent much time in 8.0 Host UI and didn't realize we can now revert snapshots at the ESXi level.  So, I changed things up a bit to work without a cron job or Windows task.

    1. Migrate vCenter to first host of cluster.
    2. Disconnect from vCenter
    3. Connect to first host
    4. Revert vCenter from snapshot on first host.
    5. Power on vCenter.
    6. Probe vCenter to be back online.
    7. Connect to vCenter.