How to keep or ignore the UUID when you power on a virtual machine

We have a scenario where we are mirror of VMs from one site to another site for BCP which has a separate instance of the VC.

We pre-record the virtual computers hosted NFS in virtual center.

When we need to recover break us the mirror and power on the machine.

VC then promp with the question, you want to keep or throw the UUID.

How can be script as its easy to answer a few virtual machines but a pain for possibly up to a hundred?

There are a few things to keep in mind when you want to start the guests and answer the question in this way.

(1) the Start-VM cmdlet will wait for the prompt to start, but there is a question waiting it will never happen.

==> the solution is to use the Start-VM cmdlet with the parameter -RunAsync , this way the cmdlet will not wait.

(2) when a client starts, it will take some time before the issue appears.

==> the solution is to wait until the question is displayed with a loop

(3) to get the current status of the prompt, the script needs to get the VirtualMachine object with each pass through the loop.

The properties of the $vm variable are not automatically updated unless the script retrieves the object with the cmdlet Get-View.

(4) the purpose of the Question is present when the question is displayed. Prior to this point, this object is $null.

==> to avoid execution of the StartsWith method on a $null object if statement first checks to see if the object in Question is present.

The script relies on the fact that the two conditions that are combined with - and the operator are executed from left to right.

This is probably not a good programming practice and should be solved by using two nested If statements.

The following script implements all the points made above.

Note that it can only be used for the issue of msg.uuid.moved.

The script responses with choice 2 which is the choice of 'keep '.

$qMsgUuidMoved = "msg.uuid.moved:"
$choiceKeep = 2

$vmImpl = Get-VM "TestPC"
$vmImpl | Start-VM -RunAsync

do{
  $vm = $vmImpl | Get-View
  if($vm.Runtime.Question -ne $null -and $vm.Runtime.Question.Text.StartsWith($qMsgUuidMoved)){
    $vm.AnswerVM($vm.Runtime.Question.Id, $choiceKeep)
  }
} until ($vm.Runtime.PowerState -ne "poweredoff")

Write-Host $vm.Name "started"

Tags: VMware

Similar Questions

  • How to specify the file of virtual hard disk when you create a new virtual machine using virtual hard disk on the data store?

    I'm new to PowerCLI and find quite simple, but in the documentation I read, I don't see how to use a virtual hard drive, existing on a data store when you create a new virtual machine.

    Is this simple registration on the virtual hard disk, or did I miss something?

    My current create VM is the following statement:

    New-VM

    -Name $TargetHostName -host $TargetVMCenterHost -data store $TargetVMCenterDatastore DiskMB - 20000 -MemoryMB $TargetHostMemoryMB -NumCPU $TargetHostCPUs -ID $TargetHostOS -CD -Description $TargetHostName

    Didn't notice this before, but I think that vSphere will use a backslash instead of a slash in the paths.

  • Qosmio X 770 - 11 c - how to disable on board the speakers when you use Line Out?

    Hello

    Is it possible to disable on board to intervene when the output line is used.

    Currently, if I plug in a cable to the socket of hadphone and choose alignment on the realtek Control Panel, sound is output line out as expected, but also through the internal speakers.

    Is it possible to stop this and don't have sound out through the output line?

    Thank you

    Graeme

    If you want to hear his helmet only you should choose option helmet.
    Disconnect the cable and reconnect it. When you see the small window on the screen where you can choose between the headphones and output line options choose headphones and you'll hear on external display only.

    In case you have disabled this pop-up dialog box you can activate it manually. Open the Realtek Manager connect the external device and when you see active point black on the right side make double click here and change the settings.

  • I have several symbols, how can we showed above the others when you click it?

    I have an animation that is a City/Beach/sea, and different parts of the city are symbols that can be clicked on, for example a boat in the sea could be clicked that would then lead the boat. My problem is that the boat could grow to fill the screen, then the animation playing, but as there are many other symbols, then another symbol could be on top of the animation clicked on / reading. Ideally when each animation is clicked, it would move to the top of the list of layers, but I guess that's not possible, so I was wondering if anyone had a better way to do this?

    You need to change the z-index when you click on a higher level and return it to its original level when it ends, or when the user clicks on another symbol.

  • Blue screen when you create a new virtual machine from an acronis image.  ESXi 5.0

    I'm trying to create a virtual machine in my ESXi 5.0, from acronis backup.  The backup is W2003.

    The virtual machine is created, but when it tries to start on W2003, he quickly shows a blue screen for a second or two, then try to restart.

    I suspect that it is a hard disk driver, but I don't know how to correct it.    I couldn't see anything in the Bios of the virtual machine to select type of HD.

    This fixed my issue.

    Glad to hear that it works now. Even if VMware Converter 4.3 works, I would say that you are using the latest version of Converter for future conversions.

    André

    PS: Please consider to mark the question as answer. This could help other users with similar issues.

  • How promt user to save the changes when you change the non-base fields?

    Hello
    I have a form with two tabs. The datablock Block_1 on tab_2 is based on a view of database. But all the displayed items of the Block_1 are non-base of data elements. Whenever a user changes some elements of Block_1 and press the button Save, the values of non_db elements copied from the db_items (based on the view), and commit_form is called. It works very well.
    But the problem here is: after the change of some elements of block_1, if the user navigates to another form/option in the menu, the shape is not promt the user to 'save changes' and all changes are lost. How can I fix it?
    I have a form level key-release trigger, (which does not fire) with the following code: -.
    Declare
      X  Number;
      alert_is             alert;
    Begin
          
    If :System.Mode = 'ENTER-QUERY' Then
         
            Exit_Form;
           
    Else
      If :System.Form_Status In ('NEW','QUERY') Then
           alert_is := FIND_ALERT('TMPL_EXIT'); -- "Are you sure you want to exit?"
        X := Show_Alert('TMPL_EXIT');
        
        If X = Alert_Button1 Then
           Exit_Form(no_validate);
        End If;
        Else
           Exit_Form;
      End If;
    End If;
    End;

    When button preesed trigger that fills your block:

    --somewhere in loop after NEXT-RECORD and assigning values:
    set_record_property (:system.cursor_record, :system.cursor_block, STATUS, QUERY_STATUS );
    

    Now you can copy the values of the elements not db to db items in when-validate-item.

    Of course, it is a quick fix and dirty. Good way would be to solidarity block using EXECUTE QUERY, delete everything in mirror and do you calculations in a trigger post-requete

    Published by: Slava Natapov on December 9, 2009 14:18

  • Ignore the layer when you print

    Does anyone know if there is a way to put a layer in photoshop to print?  I like to leave a layer as shown, but there do not print when sent to the printer.  Basically, I have a model, and for purposes of location, I like to leave some boxes etc upwards (guides do not work as it ends up being so many guides it doesn't help).

    Looking forward to possible solutions.

    Just grasp at straws alternative...  Could you do a script or action that places the image data in the right place for each type of media you are printing on?

    -Christmas

  • When you run a single virtual machine on the host computer, is it ok to assign all the processors for comments

    I have a single guest Windows 7 Pro running on the host ESXi 5 U1.   It will always be in a 1-1 configuration (we needed server hardware, but with BONES desktop for purposes of licensing).  The host CPU is an E5603 (Quad - core 1.6 GHz).  I want the guest to have the maximum amount of possible processor cores, because a true multi-threaded application runs.  Because Windows 7 is limited to 4 cores, I disabled hyperthreading on the processor so that when I assigned 4 cores the VM, I get all 4, not the half because of hyperthreading.

    I am setting for claim processor between the host and the guest?  Should I only assign 3 carrots to the guest while it is still available for the host?

    With the requirement, it's guessing more than knowing what to configure. I think that with 2 Dual-Core configuration, I suggested above, you're on the save side.

    André

  • How to set up an alert message when vmtools arrested runningin a virtual machine?

    I am running the latest vcenter and vpshere 5.5

    Is there a such alarm available out of the box or should I create it?

    I would like to set this alarm to level vcenter, so it can control all VM

    Thank you!

    Check the status of VMWARE tools

  • How to ignore the prompt when calling storeUserConfig()?

    Hello

    WLST, is it possible to bypass/ignore the prompt that you get when you call storeUserConfig()? You must answer y or n to allow/disallow the creation of the user configuration and key files.

    --
    Thomas Isaksen

    Thomas, I have not tried myself, but an announcement on this forum for a few years there was an answer for WLS 9.1:

    Re: How to specify response with storeUserConfig in WLST?

    -Dweblogic.management.confirmKeyfileCreation=true
    

    -steve-

  • How to remove Skype in the taskbar when connected

    Hello

    I would like to be able to rely on "Skype" > "Close", then the program would close and not only reduce the window - instead of having to click on the notification list, click on the Skype logo and press "quit".

    Anyone of you guys know how to do this? (Or if it's possible?)

    Thank you. (:

    Mathilde.

    Tools > settings > advanced > Miss keep Skype in the taskbar when minimized. Litte Skype icon down by the clock is Skype in systray not the bar of tasks, and as systray programs you must righclick and leave them, this is normal.

  • How can I disable the voice when you type with iOS 10.0.1

    How can I disable the voice when you type using iOS 10.0.1?

    GO to settings - general - accessibility-speech - Feedback-turnoff typo Word...

  • I just picked up a 12 inch I have pad PRO and bought a keyboard provided by Apple, however I find that the base remains unstable and keeps the hustle when you type, the seller it says it's a design flaw. Can someone tell me if this is the case?

    I just picked up a 12 inch I have pad PRO and bought a keyboard provided by Apple, however I find that the base remains unstable and keeps the hustle when you type, the seller it says it's a design flaw. Can someone tell me if this is the case?

    find it hard to imagine that Apple could sell these defective products.

    If the seller is an authorized Apple reseller, an independent company,

    You may need to ask you if you could see & try a different product sample

    because you might be looking at something that has a defect.

    {According to the related help page, Type position should be more

    stable to use. However if the keyboard is not flat, this sounds like default.}

    Sounds as if you're not at the official Apple Store (apple retailer)

    but, on the contrary, are somewhere else. Could you give more information?

    Some keyboard accessories are made by third party companies; so

    If the product has an Apple product model number, we note here.

    When considering the purchase of an accessory, it's a good idea to test

    and check in the store before you buy. An official Apple Store has

    a different return policy as an independent reseller of Apple.

    Don't know if I can be useful; These chat rooms are usually Apple

    users of products such as yourself, who have taken their unpaid time

    to see if they can help the other users of the product.

    Good luck...!

  • How can I remove the 'Subscribe now' button and the topic when you see an RSS feed?

    How can I remove the 'Subscribe now' button and the topic when you see an RSS feed?

    It is a yellow box that appears at the top of the page. It has options to subscribe to the RSS feed displayed.

    How can I remove this whole box to display?

    Thank you
    ~ Michel

    Make sure that the userContent.css file is a CSS (cascading style sheet) file and is not a hidden .txt file extension.

    You can use this button to go to the Firefox profile folder:

    • Help > troubleshooting information > profile directory: see file
  • Keep gettig this error message when you try to connect to Firefox, the proxy server refuses connections.

    Redownloaded Firefox and keep getting this error message when you try to connect: proxy server refuses connections

             Firefox is configured to use a proxy server that is refusing connections.
    
     Check the proxy settings to make sure that they are correct.
     Contact your network administrator to make sure the proxy server is
       working.
    

    Go to Options > advanced > network > connection > settings, then choose 'no proxy '.

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    It is important that you keep updated IE. The information included with your question indicates that you use IE7; you need to update to IE8 for your own protection. IE9 will be available for Windows XP.

Maybe you are looking for