Hi,
Anyone got an idea on how to use VI Toolkit to query the "Virtual Machine Startup/Shutdown" status (Enabled/Disabled)
I have done some testing, and thought I was on the path with How To: Accessing the entire Virtual Infrastructure API from PowerShell.
$hostSystem = find-entityview -viewtype HostSystem
$autoStartRef = $hostSystem.configManager.autoStartManager
$autoStartManager = get-view -MoRef $autoStartRef
but I've not found the equivalent autoStartManager settings for vm or guest?
Thanks
Craig
I'm not sure why you expect to see the autostart feature in the guests, the autostart feature is, afaik, an ESX-feature.
From the HostAutoStartManagerConfig you have access to the powerInfo property.
This is an array, consisting of AutoStartPowerInfo objects, that describes the power-on / power-off behavior for virtual machines.
You can get to the HostAutoStartManager object without using the find-entityview cmdlet.
$asMgr = Get-View ((Get-View (Get-VMHost -Name <esx-host>).ID).ConfigManager.AutoStartManager)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm not sure why you expect to see the autostart feature in the guests, the autostart feature is, afaik, an ESX-feature.
From the HostAutoStartManagerConfig you have access to the powerInfo property.
This is an array, consisting of AutoStartPowerInfo objects, that describes the power-on / power-off behavior for virtual machines.
You can get to the HostAutoStartManager object without using the find-entityview cmdlet.
$asMgr = Get-View ((Get-View (Get-VMHost -Name <esx-host>).ID).ConfigManager.AutoStartManager)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Nice - ok, that's got me to where I need to be.
Problem was that I was thinking myself into a corner, and had trawled my way through many of the levels of config & PowerInfo etc - expecting to find "Enabled" and "Disabled" values.... rather than just an array containing those that are "Enabled"
You were 100% correct in guessing what I was asking for, and thanks for the rapid response to both questions
Cheers