# Non-Leaf AD Object deletion issue in AD

**URL:** <https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363>\
**Category:** SHF Discussion and Questions\
**Tags:** access-requests, rules, provisioning, apis, sailpoint-identity-security, connectors\
**Created:** [September 3, 2026, 8:54am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363 "2026-09-03T08:54:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PrashRV](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@PrashRV](https://developer.sailpoint.com/discuss/u/PrashRV)\
**Post date:** [September 3, 2026, 8:54am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363/1 "2026-09-03T08:54:43Z")

</div>

Hi,

We have a issue in deleting AD user objects which is having dependency like child objects in AD.

We have tried adding _ **DeleteSubtree** _ in delete provisioning policy but the still seeing error like below

**[2026-09-01\_03-12-24AM] upstreamErrorMessage is '[Error occurred while deleting the account CN=Joe Camiolo,OU=SB-Terminations,OU=Users,OU=Accounts,OU=TestOU,DC=\*\*,DC=ORGThe directory service can perform the requested operation only on a leaf object. The directory service can perform the requested operation only on a leaf object. 00002015: UpdErr: DSID-031A121E, problem 6003 (CANT\_ON\_NON\_LEAF), data 0 00002015: UpdErr: DSID-031A121E, problem 6003 (CANT\_ON\_NON\_LEAF), data 0 . HRESULT:[0x80072015]. In order to delete a non-leaf object, ‘deletesubtree’ argument must be set as true in the account/object request.] ’**

Tried through before delete rule to delete child objects before and let sailpoint execute the user object deletion naturally but seeing error _ **“Access is denied”** _ in before delete rule but when we try with same service account to delete the child objects through prowershell command prompt, then child objects are deleted.

Need help on this..

Thanks

---

<div class="post-metadata">

**Author:** ![punna0001](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/punna0001/32/42011_2.png) [@punna0001](https://developer.sailpoint.com/discuss/u/punna0001)\
**Post date:** [September 3, 2026, 9:17am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363/2 "2026-09-03T09:17:07Z")

</div>

Welcome back, Prashanth.

Start with the Delete provisioning policy and try `deleteSubTree` with a Boolean value of `true` ([reference](https://developer.sailpoint.com/discuss/t/error-when-removing-ad-accounts-wth-child-objects-6003-cant-on-non-leaf/10305)).

If `CANT_ON_NON_LEAF` remains, use an AD Before Delete rule (`ConnectorBeforeDelete`) with a local IQService script to add `deletesubtree=true` as an `AttributeRequest` to the delete `AccountRequest`. This approach has been confirmed working for the same ISC AD error ([reference](https://developer.sailpoint.com/discuss/t/set-deletesubtree-to-true-when-deleting-ad-accounts/79415), [rule documentation](https://developer.sailpoint.com/docs/extensibility/rules/connector-rules/before-and-after-rule-operations/)).

For the `Access is denied` error, check which account the IQService PowerShell session is using. A script working manually with the AD source account does not necessarily mean the IQService script has the same permissions ([IQService prerequisites](https://documentation.sailpoint.com/connectors/iqservice/help/integrating_iqservice_admin/system_requirements.html)).

Also confirm that the account performing the recursive delete has AD Delete Subtree (`ADS_RIGHT_DS_DELETE_TREE`) permission on the object. Without it, the tree delete can fail with access denied ([Microsoft](https://learn.microsoft.com/en-us/windows/win32/ad/access-control-and-object-deletion)).

---

<div class="post-metadata">

**Author:** ![kartheek\_gopu](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kartheek\_gopu](https://developer.sailpoint.com/discuss/u/kartheek_gopu)\
**Post date:** [September 4, 2026, 10:23am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363/3 "2026-09-04T10:23:12Z")

</div>

Can someone please guide us on how to get the provisioning plan in the before delete rule so that the attribute request of deletesubtree = true could be set.

---

<div class="post-metadata">

**Author:** ![punna0001](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/punna0001/32/42011_2.png) [@punna0001](https://developer.sailpoint.com/discuss/u/punna0001)\
**Post date:** [September 4, 2026, 10:45am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363/4 "2026-09-04T10:45:27Z")

</div>

Hello Kartheek. You do not get a full `ProvisioningPlan` in `ConnectorBeforeDelete`. IQService passes the delete `AccountRequest` as `$env:Request`, so modify that request directly.

```auto
Add-Type -Path "utils.dll"

$sReader = New-Object System.IO.StringReader([System.String]$env:Request)
$xmlReader = [System.Xml.XmlTextReader](
    [SailPoint.Utils.Xml.XmlUtil]::getReader($sReader)
)

$requestObject = New-Object SailPoint.Utils.objects.AccountRequest($xmlReader)

$attributeObject = New-Object SailPoint.Utils.objects.AttributeRequest
$attributeObject.Name = "deleteSubTree"
$attributeObject.Operation = "Add"
$attributeObject.Value = $true

$requestObject.AttributeRequests.Add($attributeObject)

$requestObject.toxml() | Out-File $args[0]

```

SailPoint documents this read/modify/write-back pattern for IQService before scripts ([reference](https://documentation.sailpoint.com/connectors/iqservice/help/integrating_iqservice_admin/before_after_scripts.html)). The AD connector guide also shows `deleteSubTree` with `Add` and Boolean `true` ([reference](https://community.sailpoint.com/mpomh84452/attachments/mpomh84452/IIQ_docs/393/1/7_3_SailPoint_Direct_Connectors_Admin_and_Config_Guide.pdf)).

So there is no provisioning plan to retrieve here. Modify the `AccountRequest` directly.

---

<div class="post-metadata">

**Author:** ![PrashRV](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@PrashRV](https://developer.sailpoint.com/discuss/u/PrashRV)\
**Post date:** [September 4, 2026, 11:59am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363/5 "2026-09-04T11:59:01Z")

</div>

Thanks Alot, harish for you help..

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [November 3, 2026, 11:59am UTC](https://developer.sailpoint.com/discuss/t/non-leaf-ad-object-deletion-issue-in-ad/221363/6 "2026-11-03T11:59:25Z")

</div>

Closed on November 3, 2026, 11:59am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
