Applying Host Profile Fails With Error: Cannot remove datastore '(Datastore Name)' because One or more virtual machines are still registered on it. Correct the problem and retry the operation..
search cancel

Applying Host Profile Fails With Error: Cannot remove datastore '(Datastore Name)' because One or more virtual machines are still registered on it. Correct the problem and retry the operation..

book

Article ID: 424705

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • When attempting to apply a host profile to the cluster, the following error is displaying after hitting remediate:
    Host profile apply failed with error: Cannot remove datastore '(Datastore Name)' because One or more virtual machines are still registered on it. Correct the problem and retry the operation..
  • The cluster has recently been upgraded from vSphere/ESXi version 7.0 to 8.0

Environment

  • VMware vSphere / ESXi 8.0

Cause

  • You cannot directly apply a 7.0 host profile to a cluster that has been upgraded to version 8.0.
  • A valid version 8.0 host profile must be applied to the hosts that have been upgraded to version 8.0

Resolution

  • To resolve this issue, a valid 8.0 host profile must be used. 
  • To use an existing 7.0 host profile, you must extract the host profile from a host that is targeted for remediation and convert it to an 8.0 version before applying it to the targeted hosts. 
  • To accomplish this, follow the below steps:
  1. Navigate to Menu>Inventory and select a host from the cluster that you are attempting to apply the profile to.
  2. Right click on the host, select host profiles, then select extract the profile.
  3. Rename the profile so that you know this is an 8.0 version of the profile.
  4. Once the newly extracted profile is complete, navigate back to the host>System>Host Profile>Select Change in the upper right pane>Select the newly renamed extracted profile. 
  5. Select Check Compliance. Once this is complete, then select Remediate. 
  6. Select the option to reboot hosts automatically that need it for remediation so it will automatically reboot if deemed necessary. (After remediation if a reboot is required, the profile will not be fully applied to the selected host until it has been rebooted)

Once this is completed, look for the host to be compliant now that the profile has been successfully applied to the host. Repeat these steps for all hosts targeted to use this profile. 

Additional Information

How Do You Upgrade vSphere Host Profiles and vCenter Server from 7.0 to 8.0
https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/host-profiles-8-0/recommended-host-profiles-upgrade-workflows/vc-upgrade-from-6-7-to-7-0-7-0-to-8-0.html