Remotely Power On / Power Off a VM in VMware ESXi via SSH
ESXi 4 -
vim-cmd vmsvc/getallvms - this command checks for your existing VMs, then run
vim-cmd vmsvc/power.off 48 - <vm id> on my ESXi is 48.
If you need to restart your VM on a daily basis I would edit and add the cron job in:
var/spool/cron/crontabs/root
Command for restarting any vm is:
vim-cmd vmsvc/power.restart <vm-id
1. Use grep to find the ID of your VM (1008 in this example):
2. Quick sanity check to verify the VM is actually powered off:
3. Power on, wait a few moments, and check status again:
4. Connect with ssh (or RDP, if targeting a Windows VM) and get on with things
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.