How to control maximum number of VMware snapshots w/PowerCLi


Six years ago, the VMware guru William Lam wrote this excellent article. Today we will automate his solution with PowerCLi.

Please meet the Set-MaxSnapshotNumber function from my PowerCLi Vi-Module module.

The function can do three things:

  • Get maximum allowed snapshot number

  • Set maximum allowed snapshot number

  • Prohibit taking snapshots at all

Moreover, it is all for multiple VMs.

Let’s see examples.

  • Get report with –Report parameter.
Get-Cluster PROD | Get-VM | Set-MaxSnapshotNumber -Report


  • Prohibit taking snapshots for particular VM(s).
Get-VM vm1, vm2 | Set-MaxSnapshotNumber 0

02.Set-MaxSnapshotNumber_Prohibit Snapshot

After that, we will not be able to take snapshots for this VM and will get error message in the Recent Tasks pane.


The same error we will get in the PowerCLi console while trying to take a snapshot.


The function supports –Confirm flag to suppress the confirmation dialog while creating a snapshot. Use it carefully in production environments!

Get-VM vm1, vm2 | Set-MaxSnapshotNumber –Number 5 –Confirm:$false


The –Number parameter may be any integer from zero to 496.

  • Zero – Snapshots prohibited

  • 496 – Maximum supported value

  • 31 – The default value

This is positional parameter and it can be omitted. It is enough to supply its value only. If you omit the value itself too, the default value 31 will be used.

Get-VM vm1, vm2 | Set-MaxSnapshotNumber 496
Get-VM vm1, vm2 | Set-MaxSnapshotNumber


Very important!

  • The function does not affect existing snapshots (does not delete, does not disable or whatever).

In below example we have VM with 20 existing snapshots and 31 snapshots allowed. We prohibit snapshots for this VM (set maximum allowed snapshot number to zero). After that, we cannot create no one additional snapshot, but all previously created snapshots are in order.


  • The function does not do any manipulations with snapshots themselves. It only edits one specific VM advanced setting, named snapshot.maxSnapshots.

VM -> Edit Settings… -> VM Options tab -> Advanced category -> Edit Configuration… button

  • This setting affects future snapshots only.



For those of you who loves short commands I have added alias for the Set-MaxSnapshotNumber, named maxsnap.

Get-Alias -Definition Set-MaxSnapshotNumber
Get-VM vm1 | maxsnap 2


For more details about the function, please take a look at the content based help and examples.

Get-Help Set-MaxSnapshotNumber –Examples
Get-Help Set-MaxSnapshotNumber –Full
Get-Help Set-MaxSnapshotNumber –Parameter Number

You may also like:

Test-VMHotfix/Test-VMPing – Check VMware VM for installed Hotfixes
Move-Template2Datastore – Migrate VMware VM Templates to another Datastore
Get-RDM – How to get RDM (Raw Device Mappings) disks
Convert-VmdkThin2EZThick – Convert Thin Provision VMDK disks to Thick

4 thoughts on “How to control maximum number of VMware snapshots w/PowerCLi

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s