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:

[table id=3 /]

Create snapshot including memory

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


 [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:~]