# How to un-manage an Instance/VM/Host

## Description

A managed VM (and associated Instance) needs to be unmanaged and returned to Discovered type.

## Solution

### About this task

Delete the record from the Infrastructure  >  Compute (! not from Provisioning - Instances) selection with the following configuration in the Delete modal:

- `Remove Infrastructure` UNCHECKED
- `Remove Associated Instances` Must be checked if the server has an associated Instance, as deleting the VM but not the Instance would result in an abandoned Instance thus not allowed.
- `Force Delete` UNCHECKED

The most important items to be aware of when “un-managing” an Instance/VM/Host are:

### Procedure

1. The “Remove from Infrastructure” flag when deleting a VM or Host in HPE Morpheus Enterprise determines if the actual VM is deleted from the target Infrastructure. 

   - Checking “Remove Infrastructure” means you WANT TO DELETE THE ACTUAL VM. Typing “DELETE” in the confirmation field is required when “Remove From Infrastructure” is enabled.
   - Unchecking “Remove Infrastructure” means you only want to delete the record in HPE Morpheus Enterprise but leave the actual VM untouched.
2. Deleting an Instance will always remove Infrastructure. 

   IMPORTANT

   REPEAT: Deleting an Instance from the `Provisioning` section will always remove the VM aka Infrastructure.
3. After removing the record from HPE Morpheus Enterprise, the VM must be in a Cloud with Inventory enabled to automatically be re-discovered.

## Process

### About this task

Steps to delete a managed VM from HPE Morpheus Enterprise and, when necessary, remove the associated Instance:

### Procedure

1. Navigate to the VM (not Instance) detail page at Infrastructure  >  Compute - VMs 

   NOTE

   VM’s inside an Instance can be navigated to inside the Instance Details page by selecting the VM in the `VM's` seciton on the Instance Details page.
2. Select DELETE
3. Configure the DELETE HOST modal with the following settings: 

   ![../_images/delete_host_modal.png](https://support.hpe.com/hpesc/public/api/document/sd00007621en_us/GUID-7627FF0E-DEA9-4A41-8E6B-E1E752BA731F-high.png)
   - `Remove Infrastructure` UNCHECKED
   - `Remove Associated Instances` Must be checked if the server has an associated Instance, as deleting the VM but not the Instance would result in an abandoned Instance thus not allowed.
   - `Force Delete` UNCHECKED

   IMPORTANT

   If you have to type DELETE that means the `Remove Infrastructure` flag is selected and you are confirming deletion of the actual VM. Ensure `Remove Infrastructure` is UNCHECKED when you want to leave the VM intact!
4. Select DELETE
5. The VM and associated Insatnce will be removed from HPE Morpheus Enterprise but the actual VM will remain.
6. Wait up to 5 min or click REFRESH on the associated Clouds details page to force a cloud sync. 

   NOTE

   `Inventory` must be enabled on the associated cloud for the VM to automatically be re-discovered by HPE Morpheus Enterprise.
7. The VM is now back in HPE Morpheus Enterprise as discovered/unmanaged. To managed and create a new Instance from the VM, select ACTIONS : Convert To Managed.
