Poweron and Poweroff Esxi instance from CLI using a Python script
Apr 07
Hi,
I have to agree that to start a esxi node i was depending heavily on a windows VM and then was using a VSphere client to connect to a Esxi 5.5.
In a typical day all of my VM’s are hosted on Esxi and am not any advanced user of esxi by any stretch of Imagination.
It came down to a point where i had to manually click close to 8 VMS in order to boot up and all this was sort of irriatating for me, so i wrote a very basic script which can do this for me. Most of the experienced VM admins have been doing this for very long, for someone like me or anyone who is new to Esxi this is going to help.
Here is the code for the script, all you need to do is to copy to your lab esxi, obviously if any one using production esxi they already know how to manage this.
https://github.com/yukthr/auts/tree/master/random_programs/vmware_scripts
Requirement – I have 5 Vm-machines and i would like to start them via script and also power them off.
First things, list the Vm-instances
Now that we have it, let explore the script to poweron the specific instances, again power-off is exacty similar
https://github.com/yukthr/auts/blob/master/vmware_scripts
Basically, Below program is tryin to boot a list of VMs provided in vm, if you want to use this, modify the vm list with the appropriate local Vm number from getallvms output
Am aware there are many network engineers who are starting to realize the power of Esxi over Bare Eve-ng, both have their own advantages anyways, but anyone starting with Esxi, this is not at all a Bad Idea !
Regards
Rakesh M
May 03, 2018 @ 02:47:57
Looks like ESXi has python natively installed?
BTW – Always love reading your posts!
May 03, 2018 @ 21:23:35
Hi Oke, Glad you like the posts, yes even i realized it very recently.
Jul 28, 2018 @ 21:14:01
github link is not working Rakesh bro .. Could you please take a look.
Jul 29, 2018 @ 04:02:21
I pasted a more detailed link Raja, Thanks for the input anyways, it should work for you now
https://github.com/yukthr/auts/tree/master/random_programs/vmware_scripts