Skip to main content

ESXi

Reset license

#!/bin/sh
rm /etc/vmware/license.cfg
cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg
/etc/init.d/vpxa restart

Cron

By default, /var/spool/cron/crontabs/root is read only, use :w! in vi to save.

kill $(cat /var/run/crond.pid)
vi /var/spool/cron/crontabs/root
crond

ESXi will overwrite cron file on boot, change /etc/rc.local.d/local.sh to update cron file

# /etc/rc.local.d/local.sh
kill $(cat /var/run/crond.pid)
echo "* * * * * <cron job>" >> /var/spool/cron/crontabs/root
crond

VM

Show all VM

vim-cmd vmsvc/getallvms

Power on VM

vim-cmd vmsvc/power.on <VM ID>

Reboot VM

vim-cmd vmsvc/power.reboot <VM ID>

SSH public key

Reference

/etc/ssh/keys-<user name>/authorized_keys

Create partition table

Reference

partedUtil setptbl "/vmfs/devices/disks/<device>" { msdos | gpt }