Hello all,
I'm using this oneliner to answer vm questions:
get-vm | where {$_.powerstate -eq "PoweredOn"}| get-vmquestion | Set-VMQuestion -Option "Abort" -Confirm:$false
It works, but it is awfully slow; about 2 VM's / minute. Is there a better/faster way to do this? Since I'll have to answer 100+ questions like this.
Hi Engelsman,
Set-VMQuestion really has some poor performance. We'll fix that in the next release. Meanwhile, check if this script works faster for you:
Connect-VIServer #### $filter = @{"runtime.powerState"="poweredOn"} Get-View -ViewType "VirtualMachine" -Filter $filter -Property "runtime.question" | % { if( $_.Runtime -and $_.Runtime.Question){ $answer = $_.Runtime.Question.Choice.ChoiceInfo | where { $_.Label -ieq "Abort" } $_.AnswerVM( $_.Runtime.Question.Id, $answer.Key ) } }
Regards,
-Angel
Hi Angel,
Thanks for the feedback. I'll give your script a try, to see how fast it goes!
Henk