Citrix Cloud - Unable to delete hosting connection, Error Connection "Connection name" cannot be deleted because it is being used by the following Objects and/or background actions.

Citrix Cloud - Unable to delete hosting connection, Error Connection "Connection name" cannot be deleted because it is being used by the following Objects and/or background actions.

book

Article ID: CTX275260

calendar_today

Updated On:

Description

When attempting to delete hosting connection or resources in Citrix Cloud Management Console, the following message appears:

Connection "Hosting Connection Name" cannot be deleted because it is being used by the following Objects and/or background actions:

Resolution

1. Download and install Citrix Remote PowerShell SDK
https://docs.citrix.com/en-us/citrix-virtual-apps-desktops-service/sdk-api.html
Note: It recommend not to install Remote PowerShell SDK with any other Citrix Components installed.  For instance, do not install Remote PowerShell SDK on a Cloud Connector. 

2. Add the Citrix snap-ins:
asnp Citrix*
3. Authenticate to Citrix Cloud.
Note: If you have multiple Customers associated to your account you will get a drop down to select the correct one that you are targeting. 
Get-XdAuthentication
4. Get the PS Path of the hosting connection and resource(s)
ls XDHyp:\Connections\

connections1.JPG

ls XDHyp:\HostingUnits\

hostingunits1.JPG
Remove items in the following order. 

5. Remove the Resource(s) Path:  
Remove-Item -Path "XDHyp:\HostingUnits\Resource Name"
In the example, this would be:  Remove-Item -Path "XDHyp:\HostingUnits\VMNW"
If there are multiple Resources, repeat the command for each resource name.

6. Remove Hosting Connection Path:
Remove-Item -Path  "XDHyp:\Connections\Hosting Connection Name"
In the example, this would be:  Remove-Item -Path "XDHyp:\Connections\DublinPVS"

7. Removing Hosting connection Name: 
Remove-BrokerHypervisorConnection -Name "Hosting Connection Name"
In the example, this would be: Remove-BrokerHypervisorConnection -Name "DublinPVS"

In some cases, the connection name might have already been removed.  You could see an error on the final step stating that the connection could not be found. 

Check your work: 
 check your work.JPG
Get-BrokerHypervisorConnection | Select Name 


 

Problem Cause

Decommissioning the Hypervisor without first removing the Hosting connection from Citrix Cloud Management Console (studio) .