PowerCLI: Set VM Snapshot location

From VI-Toolkit
Jump to navigation Jump to search


author: Hugo Peeters


This powershell function allows you to setup an alternative location for storing the snapshots of your VM's. It will help you to protect your production LUN to run out of storage without having to oversize it for massive snapshots.


First, connect to a virtual server server (Connect-VIServer)

Set snapshot location for one vm (folder must already exist on datastore):

Set-VMSnapshotLocation -vm VM001 -Location "[BigAssDatastore] Snapshots"

For all vms at once (no folder specified will put all in the root of the datastore):

Get-VM | ForEach-Object {Set-VMSnapshotLocation -vm $_ -Location "[BigAssDatastore]"}

Reset the location to the original location (with the vmx file):

Set-VMSnapshotLocation -vm VM001 -Reset