Syed Jahanzaib – Personal Blog to Share Knowledge !

July 4, 2012

Howto power ON ESXi Guest machine using CLI & howto link it to the DUDE :)

Filed under: Mikrotik Related, VMware Related — Syed Jahanzaib / Pinochio~:) @ 10:08 AM

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

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 “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
\\dudepc\bin\plink.exe -ssh -l root -pw zaibpass “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.

Syed Jahanzaib


  1. 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?


    Comment by MySite — September 14, 2012 @ 1:45 PM

  2. Hello, I want to subscribe for this web site to get most up-to-date updates,
    thus where can i do it please assist.


    Comment by armurerie — October 22, 2012 @ 5:45 PM

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: