Recently had a datastore in the lab briefly fill up and some VMs go into a suspended state awaiting a Retry/Cancel question to be answered. Rather than manually answer the question on each affected VM i looked to use PowerCli. With a little digging in the PowerCli documentation I found the Get-VMQuestion & Set-VMQuestion cmdlets. In an ideal world all you would need to do is this
Connect-VIServer -Server VC01 Get-VM | Get-VMQuestion | Set-VMQuestion -Option "Retry" -Confirm:$false Disconnect-VIServer -Server VC01 -Confirm:$false
IaaS01 (c4920308-f901-45be-b99c-0095175099e9)
So when you try to pass the VM name to Get-VMQuestion it does not handle the space in the VM name and the command fails. To get around this i created a simple script to first create an array of VM names thereby avoiding the issue with the space. Running the script below against my vCenter answered about 65 VM questions while i made a coffee!
Connect-VIServer -Server VC01 $vm = @() $vm = Get-VM $answerQuestion = $vm | Get-VMQuestion | Set-VMQuestion -Option "Retry" -Confirm:$false Disconnect-VIServer -Server VC01 -Confirm:$false