VMware Cloud Community
Austinc
Contributor
Contributor
Jump to solution

query "Virtual Machine Startup/Shutdown" status ?

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
Austinc
Contributor
Contributor
Jump to solution

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

0 Kudos