r/PowerShell • u/ARSuperTech • Feb 26 '26
Question Trouble removing active Directory unknown SIDs
Hey Guys,
So, here goes. Active Directory cleanup time. I ran into some unknown SIDs that had permissions at the domain root and some other OUs of AD. I’ve double and triple checked and see that they are orphaned permissions.
When I try to remove from ADUC>security>advanced, I get a message warning me that the change I’m about to make will result in 122 new permissions being added to the access control list.
The first time I canceled out of that it updated the domain route permissions in a weird way, and there were several entries missing, except for the typical administrative groups, like administrators and domain admins. to restore the permissions from a back up that I took of the SDDL.
I tried doing it from ADSI edit but the same thing happened. I’ve also tried to script it and using CMD DSACLS to remove with no luck.
I need to remove these because the orphan SIDs have administrative delegated permissions on the root. Does anyone have any suggestions? Thanks in advance.
4
u/omglazrgunpewpew Feb 28 '26
Soooo, warnings like that somewhat typically show up when your change will cause Windows/ADUC to recalculate the DACL. Often due to a few potentials: You’re changing inheritance (enable/disable, convert inherited to explicit, things like that), you’re touching something with tons of inheritable ACEs below it, or ADUC is canonicalizing/re-writing the descriptor in a way that just makes it appear like a huge add.
I think inheritance is the right direction, but the fix is NOT doing this in the GUI and definitely do not toggle inheritance just to remove an orphaned SID.
This removes a specific orphaned SID from an AD object:
If it’s inherited, this won’t remove it and that’s kinda the point. Then you'll understand you're editing the wrong thing and need to remove it at the source, not fight the domain root and trigger a 122 permissions panic dialog.
1
u/UserProv_Minotaur Feb 26 '26
Might want to crosspost to r/activedirectory and r/sysadmin or r/Sysadmin_Technical, I suspect that some of the changes to the ACL are coming from the other security groups you have on your privileged account being applied due to the change you're making. I've normally escalated that kind of thing to the Enterprise Admin for our AD forest, because they should have an account (possibly a break glass account) that has the absolute fewest amount of administrative permissions in order to manage the environment.
-7
u/Crown_Eagle Feb 27 '26
😬 Sounds like you're in for a wild ride with those orphaned SIDs. Okay, let's tackle this beast.
First, I gotta ask: did you take another backup of AD before trying the script or ADSI edit? 🤔
Assuming you've got a solid backup, here's what I'd try:
ldap policymight help.Before trying any of these, make sure you've got a solid plan to revert changes if needed. 😅
-5
u/cracc_babyy Feb 27 '26
Hence, the inherent security risks of AD. I highly recommend HTB for remediation techniques