Skip to content

Instantly share code, notes, and snippets.

@hartsock
Created December 29, 2014 18:45
Show Gist options
  • Save hartsock/af185ac3597f8b4ef295 to your computer and use it in GitHub Desktop.
Save hartsock/af185ac3597f8b4ef295 to your computer and use it in GitHub Desktop.
A snippet from collaboration to develop a spec that you can feed to autoStartManager
testvm = # handwaving
spec = host.configManager.autoStartManager.config
auto_power_info = vim.host.AutoStartManager.AutoPowerInfo()
auto_power_info.key = testvm
auto_power_info.startAction = vim.VirtualMachine.PowerState.poweredOn #note use of constant instead of string
auto_power_info.startDelay = 60
auto_power_info.startOrder = 1
auto_power_info.stopAction = None # note: the Python constant 'None' not a string
auto_power_info.stopDelay = -1 # note the use of numeric value here.
spec.powerInfo = [auto_power_info]
host.configManager.autoStartManager.ReconfigureAutostart(spec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment