Powershell/VMWARE Snapshot Cleanup

  • Hi All,

    I saw another post about Powershell and VMware and figured I'd post this script I've been using to manage snapshots. https://gitlab.com/dafyre/powershell-utils/-/blob/master/VMware/snapshotCleanup.ps1

    If you're like us, we have timed snapshots on everything, so that every day/weeek/month a snapshot is run on various systems. The daily ones area PITA to clean up -- especially for a lot of machines.

    This script will connect to your vCenter (or VMware host) and and cleanup the snapshots you specify. It's easier done if you have your snapshots setup with something like "Daily Snapshot of blahblah" in the name.

    If run without parameters, it will prompt you for your vmware server name and credentials, and then list all snapshots that have "Daily Snapshot" in the name and are older than 8 days.
    . Run with the -liverun parameter, it will actually remove the snapshots for you.

    If there's any questions / comments / ideas for improvement, I'm all ears.