VMware Cloud Community
OBXMAN007
Contributor
Contributor
Jump to solution

Automate "I_moved it" When Powering On VMs ?

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

Reply
0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
OBXMAN007
Contributor
Contributor
Jump to solution

Hi Luc,

I will give that a try - haven't used that before - it might work - thanks again.

Reply
0 Kudos
OBXMAN007
Contributor
Contributor
Jump to solution

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!!!

Reply
0 Kudos
529122530
Enthusiast
Enthusiast
Jump to solution

I_moved option will change the vm's uuid

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos