Automation

 View Only
Expand all | Collapse all

Migration Failing due to vmware tools installation - Automate

  • 1.  Migration Failing due to vmware tools installation - Automate

    Posted Jan 03, 2022 11:57 AM

    Hi Everyone, 

    We have bunch of vm's which are failing for vMotion as some the of vmware tools installation were stuck. I am able to resolve the issue by following the below KB Article. 

    https://kb.vmware.com/s/article/1038542 

    Now, I am trying to write a script to automate the above process mentioned in the article.

    I am trying to ssh into the host using posh-ssh module to find the vmid so we can cancel the tools installation task.

    $session=New-SSHSession -ComputerName "hostname" -Credential $esxcred

    $streamssh = New-SSHShellStream -SSHSession $session

    $streamsshoutput=Invoke-SSHStreamShellCommand -ShellStream $streamssh -Command "vim-cmd vmsvc/getallvms"

    I get the output 

    $streamsshoutput
    vim-cmd vmsvc/getallvms
    Vmid Name File Guest OS Version Annotation
    1 TESTVM [Local-testhost01] TESTVM/TESTVM.vmx windows8_64Guest vmx-10
    2 TESTVM2 [Local-testhost02] TESTVM2/TESTVM2.vmx windows8Server64Guest vmx-14

    Now I need to filter only the VMID of the TESTVM2 so I can go ahead and cancel the task. I am not sure how to approach further on this.

    Can someone help me in this process?



  • 2.  RE: Migration Failing due to vmware tools installation - Automate
    Best Answer

    Posted Jan 03, 2022 12:05 PM

    Try with





  • 3.  RE: Migration Failing due to vmware tools installation - Automate

    Posted Jan 03, 2022 12:23 PM

    Thank you so much   for the Quick reply. It worked  I am able to complete the remaining script which I am looking for. I will post that here in sometime.