VMware Cloud Community
LukePruen
Contributor
Contributor
Jump to solution

Virtual Machine Startup/Shutdown

Is it possible to script the configuration of Virtual Machine Startup/Shutdown on a ESXi host?

Thanks

0 Kudos
1 Solution

Accepted Solutions
nielse
Expert
Expert
Jump to solution

There are some scripts out there who can do this but I think this one can help you:

http://ict-freak.nl/2009/06/09/powercli-set-vm-startup-policy/

Keep in mind that this won't work if you are using an HA cluster as already mentioned.

@nielsengelen - http://foonet.be - VCP4/5

View solution in original post

0 Kudos
7 Replies
nielse
Expert
Expert
Jump to solution

Even tho you can configure this via the vSphere client there are ways to do this by using the vCLI or esxcli commands.

Any specific reason why this has to be done using shell?

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
LukePruen
Contributor
Contributor
Jump to solution

Hi Nielse,

I have two identical VMs on thousands of clusters I wish to configure the startup/shutdown setting on. Rather than performing the tedious myself I am looking to script it. This could then be used on any future deployments.

Do you have an example of this?


Thanks.

Luke

0 Kudos
nielse
Expert
Expert
Jump to solution

There are ways to configure it using PowerCLI, would this be an option or does it have to be using a perl or bash script? Also which version of vSphere/vCenter are you running?

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
LukePruen
Contributor
Contributor
Jump to solution

Hi Nielse,

PowerCLI would actually be prefered.

Thanks,


Luke

0 Kudos
jdptechnc
Expert
Expert
Jump to solution

Are you doing this against hosts that are in HA clusters?  Setting the automatic Virtual Machine Startup/Shutdown settings is not supported in an HA cluster:

http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vsphere.vm_admin.doc_50%2FGUID-6CA3C...

Please consider marking as "helpful", if you find this post useful. Thanks!... IT Guy since 12/2000... Virtual since 10/2006... VCAP-DCA #2222
0 Kudos
nielse
Expert
Expert
Jump to solution

There are some scripts out there who can do this but I think this one can help you:

http://ict-freak.nl/2009/06/09/powercli-set-vm-startup-policy/

Keep in mind that this won't work if you are using an HA cluster as already mentioned.

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
LukePruen
Contributor
Contributor
Jump to solution

Hi Guys,
Let me provide a bit more information about the environment. There are multiple clusters with two ESXi hosts running a StorMagic SvSAN which is a virtual storage appliance. This is using the internal DAS storage of each ESXi host to present a mirrored iSCSI target. This allows a HA solution without the requirement of some shared external storage.
I am aware of HA restrictions when using this setting. The SVAs are located on a small local datastore not a shared one they are presenting, this could be difficult Smiley Wink . With this in mind I feel that enabling this setting is ok. vSphere 4.1 used to disable this setting after a host reboot which was frustrating in this configuration because you want your SVA to boot when the host starts. I have recently tested this with vSphere 5 and 5.1 and the setting does not appear to be disabled after a host reboot which is great for me.
I hope this explains why I wish to enable this setting. Thanks for the input and I will take a look at the link and see if I can get the script sorted.Ill update when I have somehting.
Thanks,
Luke
0 Kudos