Home > Blogs > VMware PowerCLI Blog > Author Archives: Angel Evrov

Author Archives: Angel Evrov

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

Connect-VIServer usability goodie – the new Menu parameter

Greetings to all PowerCLI users out there!

In this blog post, I want to show you one of the usability improvements that we introduced in the latest PowerCLI release. Namely, the new –Menu parameter of the Connect-VIServer cmdlet.

The functionality of this parameter is simple and useful – it lets you select a server from the ones you use most often. Here’s an example:

PS C:\WINDOWS\system32\windowspowershell\v1.0> Connect-VIServer -Menu
Select a server from the list (by typing its number and pressing Enter):
[1] aevrov-mvc-3.vmware.com
[2] localhost
[3] S10
[4] vvvvc41-ga.pc
[6] vc41-ga.pc
[9] aevrov-mvc-2.vmware.com
[10] S9
WARNING: There were one or more problems with the server certificate:
* The X509 chain could not be built up to the root certificate.
* The certificate's CN name does not match the passed value.
Name                           Port  User
—-                           —-  —-
vc41-ga.pc                     443   powershell
PS C:\WINDOWS\system32\windowspowershell\v1.0> Get-VM … 


In the example above, I called Connect-VIServer specifying that I want to see the list of recently connected servers and choose one of them. The servers are listed with numbers in front of them. I chose server ‘vc41-ga.pc’ by typing its number (6) and pressing enter. After that, PowerCLI connects to the server and I can continue working with it as usual. That’s all!

Now, let’s look at some details. The list is currently limited to the 10 servers that you use most often. When a server becomes one of the top-ten, its position is preserved until it drops out of the list. Whether a server is part of the top-ten list depends on: (1) how many times you have connected to it and (2) how long ago you have connected to it.

I hope this new PowerCLI feature is useful for you. I use it very often myself.


– Angel Evrov, MTS at VMware