Create snapshot including memory on ESXi command line

Today I have been asked how to create a snapshot directly on the ESXi host using vim-cmd including virtual machine memory.

Quick example from my lab:

Get the VMID of the virtual machine

[root@esxi:~] vim-cmd vmsvc/getallvms

Sample output:

VMIDNAMEFileGuest OSVersionRemark
121vcsa[Local2] vcsa/vcsa.vmxother3xLinux64Guestvmx-10VMware vCenter Server Appliance
124vRLi[Local2] vRLi/vRLi.vmxsles11_64Guestvmx-09VMware vRealize Log Insight
125vROPs[Local2] vROPs/vROPs.vmxsles11_64Guestvmx-11vRealize Operations Manager Appliance

Create snapshot including memory

[root@esxi:~] vim-cmd vmsvc/snapshot.create 124 "SnapshotName" "Snapshot Description" true true
Create Snapshot:
[root@esxi:~]

Result:

[root@esxi:~] vim-cmd vmsvc/snapshot.get 124
Get Snapshot:
|-ROOT
--Snapshot Name        : SnapshotName
--Snapshot Id        : 1
--Snapshot Desciption  : Snapshot Description
--Snapshot Created On  : 3/7/2019 14:33:24
--Snapshot State       : powered on
[root@esxi:~]