Home > Blogs > VMware PowerCLI Blog

Managing Virtual Machine questions with PowerCLI

Greetings to all vSphere administrators out there! This post will illustrate another vSphere feature that is interesting from an automation perspective, namely – virtual machine questions.

Virtual Machine questions are questions that must be answered before the operation of a given virtual machine can continue. These questions can arise in different situations. These situations are usually rare but when they occur they block the virtual machine and require attention before the VM can be started again. Let’s see how we can elegantly handle those VM questions with PowerCLI.

One case where a VM question can arise is when you physically copy a VM form one Datastore location to another and then add the newly copied VM to the inventory. In this case the ESX server wants to know if you have moved the VM or copied it. In the first case the UUID of the VM is preserved whereas in the second case a mew UUID is generated. The specifics of this scenario are described in this KB. The important thing here is that when you try to start the VM with PowerCLI you will get an error stating that a VM question must be answered before the VM can start.

PS D:\ > Get-VM QuestionVM | Start-VM

Start-VM : 6/27/2011 1:11:55 PM    Start-VM        This VM has questions that must be answered before the operation can continue.

At line:1 char:29

+ Get-VM *question* | Start-VM <<<<

    + CategoryInfo          : InvalidOperation: (:) [Start-VM], VmBlockedByQuestionException

    + FullyQualifiedErrorId : Client20_VmServiceImpl_WrapInVMQuestionWatchingTask_HasQuestions,VMware.VimAutomation.ViCore.Cmdlets.Commands.StartVM

PS D:\ >

 Now you know a question is preventing this VM from starting. What you want to do is get the question and answer it. This is done with the Get-VMQuestion and Set-VMQuestion cmdlets.

PS D:\ > Get-VMQuestion


Text                                               Options              Default

—-                                               ——-              ——-

msg.uuid.altered:This virtual machine might have b {Cancel, I moved it, I copied i

een moved or copied.                                I copied it}        t

In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied.

If you don't know, answer "I copied it".

PS D:\ >

You can answer the question this way:

PS D:\ > Get-VMQuestion | Set-VMQuestion –Option "I copied it"


Answer 'I copied it' to VM question 'msg.uuid.altered:This virtual machine might have been moved or copied.

In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied.

If you don't know, answer "I copied it".

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

PS D:\ >

 Alternatively, you can specify that you want to give the default answer of the question (every VMQuestion has a default answer):

PS D:\ > Get-VMQuestion | Set-VMQuestion –DefaultOption

You can also cancel the Power-On operation by answering “cancel” to the question:

 PS D:\ > Get-VMQuestion | Set-VMQuestion –Option cancel


I hope this will be useful.


-Angel Evrov, MTS at VMware

20 thoughts on “Managing Virtual Machine questions with PowerCLI

  1. Shawn

    Let’s say I am powering these machines on by importing a CSV file. Not all of the machines fire off the answer, but some of them do. Can I pipe the start-vm stuff to get-question and then set-question in this scenario? That way when I issue the power on command the question will be answered if the machine has one to answer.

  2. Angel Evrov

    Sure 🙂
    # Start the VMs
    Start-VM *
    # Some of the VMs will fire errors
    # Go through the errors and for those that are caused by questions – get the question and answer it:
    $Error | where { $_.Exception -is [VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.VmBlock
    edByQuestionException] } | % { Get-VM -Id $_.Exception.VmId | Get-VMQuestion | Set-VMQuestion -Option cancel }

  3. Shawn

    So does that script answer “I copied it” for the ones that have a question or does it cancel the power on? I am trying to understand what I see above.

  4. Angel Evrov

    It does cancel the power on. I wrote it this way as a precaution so someone won’t copy/past it and answer some questions inappropriately.
    If you want to answer “I copied it” just replace “cancel” with “I copied it”:
    ….. | Set-VMQuestion -Option “I copied it”}

  5. Shawn

    How do I pass it to confirm the answer with Yes? I really dont want it to stop and ask me but if there is no way to do that, I can handle it. 🙂

  6. Angel Evrov

    ….. | Set-VMQuestion -Option “I copied it” -Confirm:$false }

  7. Shawn

    Awesome. I got it to work! Thanks for this Angel!

  8. Rob McCoy

    Is there an updated command for PowerCLI version 5 or do the same set of commands work?

  9. Angel Evrov

    Yes, the same commands work for version 5 also.
    According to our backward compatibility policy – all functionality is available in the future releases also (unless it’s declared “deprecated”, in which case it will be available in 2 more releases and disappear after that).

  10. Aaron

    If anybody runs into Powershell having issues with catching the exception, set the ErrorAction and ErrorVariable parameters on start-vm and catch

    try {
    start-vm $server -ErrorAction Stop -ErrorVariable questionErr
    catch [System.Management.Automation.ActionPreferenceStopException] {
    write-host “Catching exception on the VM question.”
    write-host “Answering with “I moved it”
    get-vm $server | get-vmquestion | Set-VMQuestion -Option “I moved it” -confirm:$false
    catch {
    write-host “Other exception thrown”

  11. Rod

    Hi all,
    I ran a connect-viserver with invalid credentials and the line following performs a start-vm. The vm still started despite the invalid credentials. Can someone please shed some light on this for me?

  12. coupon preview

    This is the perfect site for anyone who wants to understand this topic.

    You understand a whole lot its almost tough to argue with
    you (not that I personally would want to…HaHa).
    You definitely put a fresh spin on a topic that has been discussed for ages.
    Excellent stuff, just excellent!

  13. Joseph

    I want to rename my vm by adding an _decom to it to show everyone that it is scheduled to be deleted soon. After 2 weeks delete the VM how do I schedule that with powercli. I dont know where to start with the code.

  14. Elliot

    magnificent points altogether, you simply won a new
    reader. What would you suggest in regards to your post that you made some days ago?

    Any sure?

  15. minecraft client mods

    These tournaments are excessive enjoyable too these are actual relaxed to drama too.

    In the absence of traditional mechanics “Guild Wars 2”, where players directly manipulate the priority objectives in the AI system, each player will bear the obligation for own survival.
    But keeping few things at heart and dummy practicing on the game, in order to familiarize
    while using game, can provide you with definite advantage once
    you begin playing the game.

  16. Vinyl Fence Company

    Thiss text is worth everyone’s attention. How cann I find out

  17. SnakeByte

    With vSphere 6.5 the Options for Set-VMQuestion are:
    {button.uuid.cancel, button.uuid.movedTheVM, button.uuid.copiedTheVM}

    Get-VM $VMName | Get-VMQuestion | Set-VMQuestion -Option “button.uuid.copiedTheVM” -Confirm:$false
    Get-VM $VMName | Get-VMQuestion | Set-VMQuestion -Option “button.uuid.movedTheVM” -Confirm:$false
    Get-VM $VMName | Get-VMQuestion | Set-VMQuestion -Option “button.uuid.cancel” -Confirm:$false


  18. Stefka

    Thank you SnakeByte. It works fine.

  19. https://thanhphong.art/

    I used to be гecommended this web site by means of my cousin. I’m no ⅼonger sսre whether this submit
    is written via him as no one elѕe underѕtand such designatеd
    approxіmately mү difficᥙlty. You’re incredible! Thank

  20. https://taichinhbank.vn/

    I think that what you composed made a great deal
    of sense. But, what about this? what if you wrote a catchier
    post title? I am not suggesting your content isn’t solid., however what if you
    added something that makes people desire more? I mean Managing Virtual Machine questions with PowerCLI – VMware
    PowerCLI Blog – VMware Blogs is a little vanilla.
    You ought to glance at Yahoo’s front page and watch
    how they create post titles to get viewers to click. You might
    add a video or a related picture or two to grab readers
    excited about everything’ve got to say. Just my opinion, it would make your website a little bit more interesting.


Leave a Reply

Your email address will not be published. Required fields are marked *