Searching for VMs with active questions.


for exmaple:
$vms = get-view -viewtype virtualmachine
$vms | ?{$_.runtime.question} | select name

In order to answer
assuming there is 1 question:
($vms | ?{$_.runtime.question}) | %{$_.AnswerVM($_.runtime.question.Id,’0′)}
Where 0 is for Retry because :
PowerCLI C:\> ($vms | ?{$_.runtime.question})[0].runtime.question.Choice.ChoiceInfo

Key : 0
Label : Retry
Summary : Retry

Key : 1
Label : Cancel
Summary : Cancel

So we can answer the question now with:

($vms | ?{$_.runtime.question}) | %{$_.AnswerVM($_.runtime.question.Id,’0′)}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s