I recently developed a Centralized Network Monitoring System using Mikrotik’s base THE DUDE . It is an amazing free application through which you can completely monitor your network environment and can perform various task also using single screen via web or console. I added various advance monitoring probes , You can find its demo screenshot at following link.
https://aacable.wordpress.com/2012/07/02/the-dude-show-us-your-map-series/
I decided to upgrade it from simple networking monitoring system to monitoring+management system I was already using its tool menu through which I was able to do RDP to any target windows pc, or Shutdown / Power ON any PC on the map or run any custom script to restart service on specific server, but the problem was that guest machines on VMWARE ESXI 4.0 were not responding to WOL packets (Magic Packets to power ON machine over the network), I searched over the internet but couldn’t found any solution to this, so I made my own scripts to fulfill the task.
First you need to enable SSH on your vmware ESXi box, You can enables ssh by using following guide
https://aacable.wordpress.com/2012/07/04/howto-enable-ssh-in-vmware-esxi-4-0/
Once SSH is enabled, test it by using any ssh client , for example PUTTY.
After successful logged in to ESXi host using putty, we have to find the guest machine VM ID which we want to power on, use the following command to list all machines
vim-cmd vmsvc/getallvms
You will get result something like below, Look for the VMID of the machine you want to get,
Vmid Name File
112 vmserver1 – WSUS WSUS/WSUS.vmx
16 vmserver2 – Symantec symantec/symantec.vmx
96 vmserver3 – SAMETIME vmserver3/vmserver3.vmx
For example you want to power ON the vmware1 – WSUS machine having vmid 112 , use the below command
vim-cmd vmsvc/powen.on 112
Now we can use above command and wrap it in any script or batch file or link it with the DUDE tool menu
For example if you want to execute above command using PLINK (Which is used to execute command on remote ssh server using ssh tunnel) in any batch file, use the below command
\\dudepc\share\plink.exe -ssh -l root -pw zaibpass 10.0.0.1 “vim-cmd vmsvc/power.on 112”
If you want to link it to dude Tool menu, Follow below steps
Open DUDE console, from left menu, Goto TOOLS , Click on + sign to add Tool
Type: Executable
Name: Power ON ESXi Guess OS
Command:
\\dudepc\bin\plink.exe -ssh -l root -pw zaibpass 10.0.0.1 “vim-cmd vmsvc/power.on 112”
Click on OK to save , Now open your map, right click on your desired target (vm guest) and goto tools menu, and your new tool will be appearing there, click on it and the script will execute. Its recommended to test the command before putting it on any batch file or script.
Regard’s
Syed Jahanzaib
Hi! I just wanted to ask if you ever have any problems with hackers?
My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup.
Do you have any solutions to prevent hackers?
LikeLike
Comment by MySite — September 14, 2012 @ 1:45 PM
Hello, I want to subscribe for this web site to get most up-to-date updates,
thus where can i do it please assist.
LikeLike
Comment by armurerie — October 22, 2012 @ 5:45 PM
[…] https://aacable.wordpress.com/2012/07/04/howto-power-on-esxi-guess-machine-using-cli-howto-link-it-to… […]
LikeLike
Pingback by Howto power on Vmware Workstation guest machine | Syed Jahanzaib Personnel Blog to Share Knowledge ! — September 23, 2013 @ 1:20 PM