OrphanedSid
1.1.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
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
Dependencies
This module has no dependencies.
Release Notes
1.1.0 - Safer removal, faster detection, and fixes from testing against a live domain.
A SID is reported orphaned only when its deleted object is found or every directory lookup
completed and none found it. A SID whose lookup failed, including one from a trusted domain that
cannot be reached, is reported as Unverified (new VerificationStatus and VerificationError
properties) and is never removed. A live principal found among deleted-object search results is no
longer taken as deleted.
Remove-OrphanedSid takes one backup per object, removes all of that object's orphaned entries
together, and returns one RemovalOperationResult per object; restoring such an object now brings
back every removed entry. Inherited entries are left in place with a warning.
Detection is several times faster: on a lab domain controller a typical user object went from
941 ms to 96 ms on Windows PowerShell 5.1. An unreachable domain controller costs about 42 seconds
per SID instead of 3.5 minutes.
Pipeline input of Active Directory objects now works for all three commands. -MaxRetries now
sets the retries of each search-base read and SID lookup. Logging, configuration, backup
timestamps, correlation IDs and restore messages are corrected.
See CHANGELOG.md for every change and the issue behind it.
FileList
- OrphanedSid.nuspec
- CHANGELOG.md
- Public\Find-OrphanedSid.ps1
- Private\Core\Start-OrchestrationWorkflow.ps1
- Private\Security\Invoke-RemovalVerification.ps1
- LICENSE
- Public\Remove-OrphanedSid.ps1
- Private\Core\Start-OrphanedSidSession.ps1
- Private\Security\Invoke-SecurityValidation.ps1
- Public\Restore-OrphanedSidBackup.ps1
- Private\Core\Stop-OrphanedSidSession.ps1
- Private\SID\Get-SIDAnalysis.ps1
- OrphanedSid.psd1
- Private\ACL\Get-ACLForRemoval.ps1
- Private\FileSystem\Initialize-LogDirectory.ps1
- Private\SID\Invoke-SIDProcessing.ps1
- OrphanedSid.psm1
- Private\ACL\Invoke-SIDRemoval.ps1
- Private\Logging\Format-LogMessage.ps1
- Private\SID\New-SIDResult.ps1
- README.md
- Private\ACL\Set-ModifiedACL.ps1
- Private\Logging\Initialize-LoggingConfiguration.ps1
- Private\SID\Resolve-SIDIdentity.ps1
- Classes\MemoryManager.ps1
- Private\ActiveDirectory\Get-ADObjectFromSearchBase.ps1
- Private\Logging\Initialize-LoggingSystem.ps1
- Private\SID\Test-OrphanedSID.ps1
- Classes\OrphanedSIDResult.ps1
- Private\ActiveDirectory\Get-ADObjectsSequential.ps1
- Private\Logging\Write-ADOperationSecurityLog.ps1
- Private\SID\Test-SIDFormat.ps1
- Classes\ProcessingStatistics.ps1
- Private\ActiveDirectory\Invoke-ADOperationWithRetry.ps1
- Private\Logging\Write-RemovalSecurityLog.ps1
- Private\SID\Test-SIDSecurity.ps1
- Classes\RemovalOperationResult.ps1
- Private\ActiveDirectory\Test-ValidDistinguishedName.ps1
- Private\Logging\Write-SecurityLog.ps1
- Private\System\Get-MemoryStatistics.ps1
- Classes\RestoreOperationResult.ps1
- Private\Backup\Invoke-RestoreWorkflow.ps1
- Private\Logging\Write-SecurityStructuredLogEntry.ps1
- Private\System\Initialize-MemoryManager.ps1
- Classes\ScriptConfiguration.ps1
- Private\Backup\New-ACLBackup.ps1
- Private\Logging\Write-StructuredLog.ps1
- Private\System\Invoke-GarbageCollection.ps1
- Classes\SecurityValidationResult.ps1
- Private\Backup\Restore-ACLOperation.ps1
- Private\Logging\Write-StructuredLogEntry.ps1
- Private\System\Invoke-MemoryMonitoring.ps1
- Classes\SIDAnalysisResult.ps1
- Private\Backup\Test-BackupIntegrity.ps1
- Private\Operations\Invoke-OperationWithRetry.ps1
- Private\System\Invoke-ResourceDisposal.ps1
- Classes\StreamingResultsManager.ps1
- Private\Core\Initialize-ScriptExecution.ps1
- Private\Operations\Invoke-RemovalWorkflow.ps1
- Private\Utilities\ConvertTo-DistinguishedName.ps1
- en-US\about_OrphanedSid.help.txt
- Private\Core\Invoke-MainProcessingLogic.ps1
- Private\Reporting\Write-ProcessingSummary.ps1
- Private\Utilities\Get-OrphanedSidModuleVersion.ps1
- en-US\OrphanedSid-Help.xml
- Private\Core\Remove-OrphanedSidEntry.ps1
- Private\Security\Get-SecurityDescriptor.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.1.0 (current version) | 10 | 11/12/2026 |
| 1.0.1 | 12 | 11/9/2026 |
| 1.0.0 | 8 | 11/9/2026 |