Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 232869

Re: We need to migrate 200 Windows XP/Windows server 2003 VM’s from one vCenter (say vCenterA vSphere 4.0) to another vCenter (vCenterB vSphere 5.0)

$
0
0

Hi LucD,

 

Thanks again. I did a little tweaking for the Start-VM with the below simple try/catch option to suppress this answer question issue. It works perfect.

 

try

{

    try

    {

        Start-VM -VM $vm -ErrorAction Stop -ErrorVariable custErr

    }

    catch [System.Management.Automation.ActionPreferenceStopException]

    {

        throw $_.Exception

    }

}

catch [VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.VMBlockedByQuestionException]

{

 

    $output = Write-Output "Power on operation triggered a VMBlockedByQuestionException on $vm !! `n Answering question with !!!I moved it!!!"

 

    Write-Host "$output" -ForegroundColor Green -BackgroundColor Yellow

 

    Get-VMQuestion -VM $vm | Set-VMQuestion –Option "I moved it" -Confirm:$false 

}

 

Answer Question Resolved.jpg

To answer your question actual migration is finished now ? yes until the VM Tools upto date before running Invoke-VMScript. Else the script won’t come out from the loop for validating the tools.

 

-------------------

 

 

     write-host “Waiting for VM Tools to Start” -ForegroundColor Yellow

do {

$toolsStatus = (Get-VM $vm | Get-View).Guest.ToolsStatus

write-host $toolsStatus -ForegroundColor Magenta

sleep 3

} until ( $toolsStatus -eq ‘toolsOk’ )

 

Invoke-VMScript -VM $vm -ScriptText "ipconfig /release && ipconfig /renew" -ScriptType Bat -GuestCredential $Cred

 

 

----------------------

 

Could you please help me here with some robust method & place this checking at the right situation/sequence ? if the VM VMware tools not the current version say “8389” or tools status is not ok it has to install & if it’s installed already it has to goto Invoke-VMScript. I will also try from my end.

I have attached my modified script 2 version 4 FYI & FYA.



Regards

Suresh Dhanaraj


Viewing all articles
Browse latest Browse all 232869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>