7 Replies Latest reply on Oct 15, 2019 8:28 AM by Amin Masoudifard

    How to solve "Orphaned" VM?

    hack3rcon Enthusiast

      Hello,

      I removed a VM from ESXi host but in "vCenter Server" in showed me "Orphaned". How can I solve it?

      VM-1.png

      VM-2.png

       

      Thanks.

        • 1. Re: How to solve "Orphaned" VM?
          a.p. Guru
          User ModeratorsvExpertCommunity Warriors

          Did you try to remove teh VM from the inventory in vCenter?

          Any error messages/warning when doing this?


          André

          • 2. Re: How to solve "Orphaned" VM?
            Amin Masoudifard Expert

            Hi

            Until the ESXi is under the management of host, you must do every operation by executing from vCenter tasks. Because you didn't do like this, it's possible that vCenter Server considers the object is not removed and doesn't know really what is going on ( because you did it by ESXi itself), so the vCenter considers the VM as an orphaned object. If you don't have an enable option to remove that orphaned VM by GUI management of vCenter server (through any vSphere Client), you can choose the following ways:

            1. By PowerCLI

            Connect-VIServer vCenter_Server

            $allVMs=Get-VM

            foreach ($vm in $allVMs)

            {

            if ($vm.ExtensionData.Runtime.ConnectionState -eq "orphaned") {$vm.name}

            }

            2. Remove it by connecting directly to vCenter database:

            If your database is a SQL Server you can do it by management console of SQL and query for your object and remove it from the database. but if you have VCSA, the database is the vPostgreSQL. If you want to connect to this type of database I explain it on this post:  Connect and Manage VCSA Database (PostgreSQL). Then you can connect to the database with an application like PgAdmin.

            Please mark my comment as the Correct Answer if this solution resolved your problem
            • 3. Re: How to solve "Orphaned" VM?
              Tayfun DEGER Hot Shot
              vExpert

              You experience this problem if you connect to an ESXi managed by vCenter Server with root and delete the virtual machine. If you have deleted the virtual machine, you can use the "remove from inventory" button to remove orphaned vm.

              --
              Blog: https://www.tayfundeger.com
              Twitter: https://www.twitter.com/tayfundeger

              vBlogger, vExpert, Cisco Champions

              Please, if this solution helped your problem, "Helpful" if it solves your problem "Correct Answer" to mark.
              • 4. Re: How to solve "Orphaned" VM?
                SahanVMTN Novice

                Try to perform operations from the vCenter as much as possible when an ESXi host is being managed by a vCenter as you can minimize getting these kind of issues.

                 

                Here is the steps from an orphaned VM which I managed to remove from vCenter:

                 

                Login to vSphere web client (Adobe Flex ) > Go to Virtual Machines view > Select the Orphaned VM > Right click on it > Hover on "All Virtual Infrastructure Actions"  > Select "Remove from Inventory"

                 

                Thanks and regards,

                Sahan

                • 5. Re: How to solve "Orphaned" VM?
                  Maio312 Novice

                  remove from the inventory

                  • 6. Re: How to solve "Orphaned" VM?
                    hack3rcon Enthusiast

                    This "PowerCLI" command removing Orphaned VMs or just list them?

                    • 7. Re: How to solve "Orphaned" VM?
                      Amin Masoudifard Expert

                      This one just list them (orphaned VMs) I told it to use if you don't have an option for "remove from inventory" in vSphere client.

                      Remove-VM Power-CLI let you let you remove them.

                      Please mark my comment as the Correct Answer if this solution resolved your problem