Hi!
Below is the simple script I use to power on all vms on a specific host.
I am using this script currently after migrating vms from 3.x to 4.x.
After running script, I am prompted on each vm to verify what happened to vm, etc.(in vcenter) which forces me to have to manually answer the question for each vm.
Is there a way to programmatically answer the prompt by powering on with a certain command line switch or parameter, etc. ?
Specifically, I always want to select the response "I_moved it".
script:
$allvms = Get-VM
$allvms | Start-VM -RunAsync -Confirm:$false | Out-Null
Write-Host "COMPLETE: All Servers Are Powered ON" -ForegroundColor Yellow
Did you try using the Set-VMQuestion cmdlet ?
Example 3 shows how you could use that cmdlet.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you try using the Set-VMQuestion cmdlet ?
Example 3 shows how you could use that cmdlet.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
I will give that a try - haven't used that before - it might work - thanks again.
Luc,
Once again, you solved it - below is my script - worked like a charm - now I can answer the question en masse:
script:
Get-VM | `
ForEach ( $_ ) {
$vm = $_
Write-Host "Answering Question for VM..." $vm.Name -ForegroundColor Yellow
Get-VMQuestion -QuestionText "you move this" | Set-VMQuestion -Option "moved" -Confirm:$False }
Thanks!!!
I_moved option will change the vm's uuid
True, but you can select another answer if you don't want to change the UUID.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference