Unable to Delete Resource or Host Connection due to Pending tasks

Unable to Delete Resource or Host Connection due to Pending tasks

book

Article ID: CTX231951

calendar_today

Updated On:

Description

While trying to delete a resource or host connection and Receiver displays the following error:

"resource name" cannot be deleted because they are being used by the following objects and/or background actions: There are x active background actions Please try again later."

Resolution

1.) In PowerShell do the following:

PS H:\> cd xdhyp:
PS XDHyp:\> dir
Connections
HostingUnits
PS XDHyp:\> cd .\HostingUnits
PS XDHyp:\HostingUnits> dir

The following is the output. You'll see all of your hosting units. Find the HostingUnitUid that you want to delete and copy.

PSPath : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\HostingUnits\JCT01New
PSParentPath : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\HostingUnits
PSChildName : JCT01New
PSDrive : XDHyp
PSProvider : Citrix.Host.Admin.V2\Citrix.Hypervisor
PSIsContainer : True
HostingUnitName : JCT01New
HostingUnitUid : aeb15638-1875-3a304-b359-25df52f252a2
HypervisorConnection : VMware
Metadata :
MetadataMap :
NetworkId : Network:network-4801
NetworkPath : XDHyp:\Connections\VMware\Citrix test.datacenter\XenDesktop Cluster.cluster\XD
.network
PermittedNetworks : {XDHyp:\Connections\VMwareNew\Citrix test.datacenter\XenDesktop Cluster.cluster\X
D.network}
RootId : domain-c2435
RootPath : XDHyp:\Connections\VMwareNew\Citrix test.datacenter\XenDesktop Cluster.cluster
Storage : {XDHyp:\Connections\VMwareNew\Citrix test.datacenter\XenDesktop Cluster.cluster\E
SX-CitrixXD2-OC.storage, XDHyp:\Connections\VMwareNew\Citrix test.datacenter\XenD
esktop Cluster.cluster\ESX-CitrixXD.storage}
VMTaggingEnabled : True
UseLocalStorageCaching : False
PersonalvDiskStorage : {XDHyp:\Connections\VMwareNew\Citrix test.datacenter\XenDesktop Cluster.cluster\E
SX-CitrixXDpvd.storage}

PSPath : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\HostingUnits\JCT01Old
PSParentPath : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\HostingUnits
PSChildName : JCT01Old
PSDrive : XDHyp
PSProvider : Citrix.Host.Admin.V2\Citrix.Hypervisor
PSIsContainer : True
HostingUnitName : JCT01Old
HostingUnitUid : 0b256e23-2554-3fd3-3a134-bd1323d35256
HypervisorConnection : VMwareOld
Metadata :
MetadataMap :
NetworkId : Network:network-4801
NetworkPath : XDHyp:\Connections\VMwareOld\Citrix test.datacenter\XenDesktop Cluster.cluster\XD
.network
PermittedNetworks : {XDHyp:\Connections\VMwareOld\Citrix test.datacenter\XenDesktop Cluster.cluster\X
D.network}
RootId : domain-c4960
RootPath : XDHyp:\Connections\VMwareOld\Citrix test.datacenter\XenDesktop Cluster.cluster
Storage : {}
VMTaggingEnabled : True
UseLocalStorageCaching : False
PersonalvDiskStorage : {}

2) Issue the command in bold below replacing with your HostingUnitUid

PS XDHyp:\HostingUnits> Get-ProvObjectReference -HostingUnitUid 0b256e23-2554-3fd3-3a134-bd1323d35256| fl

You should see the same count that the error was displaying.

Count : 0
ObjectId : 0b256e23-2554-3fd3-3a134-bd1323d35256
Source : ProvisioningScheme
Target : HostingUnit

Count : 48
ObjectId : 0b256e23-2554-3fd3-3a134-bd1323d35256
Source : Task
Target : HostingUnit

3) Back up your XenDesktop database and then go to the table named "DesktopUpdateManagerSchema.PendingImageDeletes". Right-click and choose "edit top 200" and locate the entries that have the same ID that you copied above and delete them.

4) If you go back to your PowerShell window and hit the up arrow on your keyboard and run the last command it should display a zero count.

5) You should now be able to delete your host connection as long as no resources are using it.
 

Problem Cause

Base disks may have been deleted in the hypervisor manually and not through Studio or machines pending a reboot could have been removed prior to being rebooted.

Issue/Introduction

Resources "resource name" cannot be deleted because they are being used by the following objects and/or background actions: There are x active background actions Please try again later."