PowerShell Genie

Find old VMware snapshots

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Find VMware snapshots older than seven days with Get-Snapshot. Report the VM, snapshot name, creation date, and size in GB.

The script

1PS> Get-VM | Get-Snapshot | Where-Object Created -lt (Get-Date).AddDays(- 7) | Select-Object VM,Name,Created,SizeGB

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Prerequisite: this needs the VMware PowerCLI module and an active vCenter connection (Connect-VIServer) — Get-VM and Get-Snapshot are PowerCLI cmdlets, not built-in.

    Show reference output
    1 VM Name Created SizeGB
    2 -- ---- ------- ------
    3 VM-WEB01 BeforePatch 9/01/2026 8:30:00 PM 12.5
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-VM | Get-Snapshot | Where-Object Created -lt (Get-Date).AddDays(- 7) | Select-Object VM,Name,Created,SizeGB
    1. Stage 1Get-VMPositional values or no named parameters
    2. Stage 2Get-SnapshotPositional values or no named parameters
    3. Stage 3Where-Object-lt
    4. Stage 4Select-ObjectPositional values or no named parameters

      How it works

      Every guest is piped into Get-Snapshot, Where-Object keeps snapshots whose Created date predates a seven-day cutoff, and the projection reports the owning VM with the snapshot name, creation date, and SizeGB.

      Adapting it

      Sort on SizeGB descending to attack the space problem directly, because one large snapshot usually accounts for more reclaimable capacity than a dozen small ones combined.

      Requirements

      VMware PowerCLI with an active Connect-VIServer session.

      If the result is unexpected

      An old-snapshot report leads to an unsafe cleanup recommendation.

      Snapshot age alone does not establish its purpose, consolidation cost or active backup dependency.

      1. Identify the owning VM, snapshot hierarchy and any backup operation before proposing removal.

      Validate the result

      Every candidate has owner review and an assessed consolidation plan.

      Keep the check reliable

      Separate reporting from removal and monitor datastore capacity during approved consolidation.

      Primary documentation

      Windows services and processes documentation

      Continue
      Genie guideFind old VMware snapshots

      Find VMware snapshots older than seven days with Get-Snapshot. Report the VM, snapshot name, creation date, and size in GB.