# How to change an attribute on a deleted object in ADLDS

**URL:** <https://forums.powershell.org/t/how-to-change-an-attribute-on-a-deleted-object-in-adlds/14954>\
**Category:** PowerShell Help\
**Created:** [September 15, 2020, 3:16pm UTC](https://forums.powershell.org/t/how-to-change-an-attribute-on-a-deleted-object-in-adlds/14954 "2020-09-15T15:16:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenwood](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kenwood](https://forums.powershell.org/u/kenwood)\
**Post date:** [September 15, 2020, 3:16pm UTC](https://forums.powershell.org/t/how-to-change-an-attribute-on-a-deleted-object-in-adlds/14954/1 "2020-09-15T15:16:24Z")

</div>

Get-ADObject can get objects using the IncludeDeletedObjects switch, but I can’t find a corresponding function with set-ADObject. The issue is that for some reason the UPN attribute is being retained when the object is deleted (even though searchFlags is set to not). I need to clear the UPN attribute from the deleted objects; I don’t want to recover them to do it, and I don’t want to purge them. This can be done via LDIFDE, but I would prefer to use powershell. When using set-object and specifying the DN for the object, but the result is that the object cannot be found. Using the same DN (with includedeletedobjects) and get-adobject will get the object, so I know the value is correct (even storing the get object in a variable, and using the variable attributes to ensure correct values, results in object cannot be found).

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/how-to-change-an-attribute-on-a-deleted-object-in-adlds/14954/2 "2024-05-16T20:28:55Z")

</div>


