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.
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
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
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
Name: Power ON ESXi Guess OS
\\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.