OrphanedSid

1.2.0

Finds orphaned SIDs in Active Directory ACLs, removes them with a backup of every ACL it touches, and restores an ACL from that backup

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name OrphanedSid

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name OrphanedSid

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2026 Jeffrey Stuhr. All rights reserved.

Package Details

Author(s)

  • Jeffrey Stuhr

Tags

ActiveDirectory AD SID OrphanedSID ACL Security Permissions Cleanup Audit Compliance Backup Restore Windows

Functions

Find-OrphanedSid Remove-OrphanedSid Restore-OrphanedSidBackup

PSEditions

Desktop Core

Dependencies

This module has no dependencies.

Release Notes

1.2.0 - Objects that were reported and could not be cleaned, removal results that say what
happened, and critical errors with error IDs of their own.
Objects that Find-OrphanedSid reported and Remove-OrphanedSid could not reach are now cleaned and
restored: a name with [ ] * ? or a backtick, a name with & ; | or %, an object that is named by an
attribute other than CN, OU or DC, and, on Windows PowerShell 5.1, a name with a comma or another
character that Active Directory escapes. The root of a single-label domain is accepted as a
search base. A path with square brackets works for -BackupPath, -LogPath, -OutputPath and
-ConfigPath.
A removal result is Success = False when an entry that discovery reported is no longer on the
object and when every entry failed to be removed, and a hosted PowerShell 7 runspace no longer
reports a success with nothing removed. The new NotFoundSIDs property lists the entries that were
not found.
Restore-OrphanedSidBackup has a -BackupFile parameter for one object from one named file, writes
security entries to the log, and finds the backup of a target that is typed with blanks after its
commas.
Critical errors have error IDs of their own, such as ActiveDirectoryModuleMissing and
ConfigurationFileNotLoaded, and a start-up failure ends the command whatever the error action is.
A -ConfigPath file that is gone when the run starts ends the run. Importing the module fails when
one of its files does not load.
A directory server that cannot be contacted no longer costs a connect timeout for every SID. The
times in the log are text with the offset from UTC on both editions. A log detail that is named
as a secret is written as [REDACTED]. The module runs under strict mode.
Automation that matches an error ID, the text of an error, the Success of a removal or the form
of a time in the log should read the Changed section of CHANGELOG.md first.
See CHANGELOG.md for every change and the issue behind it.

FileList

Version History

Version Downloads Last updated
1.2.0 (current version) 10 11/23/2026
1.1.0 14 11/12/2026
1.0.1 12 11/9/2026
1.0.0 8 11/9/2026