These commands only work for a standalone host and not for hosts attached to vcenter.
esxcli system settings advanced set -o /Mem/HostLocalSwapDir –s “Path to datastore”
esxcli system settings advanced set -o /Mem/HostLocalSwapDirEnabled -i 1
These commands are not applicable for applying to host profiles.
Once you add it to vCenter, the Host local SwapDir Enabled value becomes 0.