SPClean
1.1.6
Detects, reports, and remediates orphaned users in SharePoint Online. Identifies accounts in the User Information List whose Entra ID state is Deleted, SoftDeleted, Disabled, or GuestOrphaned. Supports AppOnly (certificate) and Interactive authentication, HTML/CSV/JSON reports, permission snapshots, and Windows Scheduled Task automation.
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) 2026 Hung Pham. Licensed under the MIT License.
Package Details
Author(s)
- Hung Pham
Tags
SharePoint SPO SharePointOnline Orphaned Cleanup M365 MicrosoftGraph PnP Governance Remediation EntraID
Functions
Connect-SPCTenant Disconnect-SPCTenant Get-SPCOrphanedUser Export-SPCReport Remove-SPCOrphanedUser Restore-SPCOrphanedUser New-SPCScanSchedule Register-SPCLicense Get-SPCLicenseInfo
Dependencies
-
- Microsoft.Graph.Authentication (>= 2.0.0)
- PnP.PowerShell (>= 2.0.0)
Release Notes
## 1.1.6 — 2026-06-27
- Fix: New-SPCScanSchedule scheduled task no longer opens a visible PowerShell window (-WindowStyle Hidden added)
## 1.1.5 — 2026-06-27
- Fix: New-SPCScanSchedule incorrectly detected Windows as non-Windows (Get-Variable $IsWindows unreliable inside module scope); replaced with [System.Environment]::OSVersion.Platform check
## 1.1.4 — 2026-06-27
- Fix: New-SPCScanSchedule -OutputPath alias added (parameter was named -ReportOutputPath, causing ParameterNotFound error)
- Docs: Restore-SPCOrphanedUser limitations — clarify soft-deleted accounts must be restored in Entra first
## 1.1.3 — 2026-06-27
- Fix: Export-SPCReport HTML footer shows correct version instead of System.Object[]
## 1.1.2 — 2026-06-27
- Fix: CI publish workflow now injects HMAC secret before packaging (license key validation works in published module)
- Fix: Interactive auth docs — add http://localhost redirect URI requirement (AADSTS50011)
## 1.1.1 — 2026-06-27
- Fix: exclude .git folder from PSGallery package
## 1.1.0 — 2026-06-26
- Register-SPCLicense: offline HMAC-SHA256 license key activation
- Get-SPCLicenseInfo: query current tier (FREE / PRO / CONSULTANT)
- Feature gates: HTML report, CreateSnapshot, Restore, Schedule require Pro/Consultant
- MkDocs Material documentation site (https://hungpham2802.github.io/spclean)
## 1.0.0 — 2026-06-22
- Connect-SPCTenant: Interactive and AppOnly (certificate/secret) auth
- Get-SPCOrphanedUser: detects Deleted, SoftDeleted, Disabled, GuestOrphaned accounts
- Export-SPCReport: CSV, HTML (colour-coded risk badges), JSON output
- Remove-SPCOrphanedUser: removes users with WhatIf/Confirm/CreateSnapshot support
- Restore-SPCOrphanedUser: re-applies permissions from JSON snapshot
- New-SPCScanSchedule: Windows Scheduled Task automation
FileList
- SPClean.nuspec
- .gitignore
- Private\Get-SPCRiskLevel.ps1
- docs\cmdlets\get-spclicenseinfo.md
- Public\License\Register-SPCLicense.ps1
- CHANGELOG.md
- Private\Invoke-SPCGraphBatch.ps1
- docs\cmdlets\get-spcorphaneduser.md
- Public\Remediate\Remove-SPCOrphanedUser.ps1
- LICENSE
- Private\LicenseManager.ps1
- docs\cmdlets\index.md
- Public\Remediate\Restore-SPCOrphanedUser.ps1
- mkdocs.yml
- Private\Save-SPCPermissionSnapshot.ps1
- docs\cmdlets\new-spcscanschedule.md
- Public\Report\Export-SPCReport.ps1
- README.md
- Private\Test-SPCConnection.ps1
- docs\cmdlets\register-spclicense.md
- Public\Scan\Get-SPCOrphanedUser.ps1
- .github\ISSUE_TEMPLATE\beta_feedback.md
- docs\cmdlets\remove-spcorphaneduser.md
- Public\Schedule\New-SPCScanSchedule.ps1
- SPClean.psd1
- .github\ISSUE_TEMPLATE\bug_report.md
- docs\cmdlets\restore-spcorphaneduser.md
- Tests\Integration\SPClean.Integration.Tests.ps1
- SPClean.psm1
- .github\ISSUE_TEMPLATE\feature_request.md
- docs\getting-started\authentication.md
- Tests\Unit\Connect-SPCTenant.Tests.ps1
- docs\comparison.md
- .github\workflows\ci.yml
- docs\getting-started\installation.md
- Tests\Unit\Export-SPCReport.Tests.ps1
- docs\DECISIONS.md
- .github\workflows\publish.yml
- docs\getting-started\quickstart.md
- Tests\Unit\Get-SPCOrphanedUser.Tests.ps1
- docs\index.md
- docs\cmdlets\connect-spctenant.md
- Public\Auth\Connect-SPCTenant.ps1
- Tests\Unit\Get-SPCRiskLevel.Tests.ps1
- docs\licensing.md
- docs\cmdlets\disconnect-spctenant.md
- Public\Auth\Disconnect-SPCTenant.ps1
- Tests\Unit\LicenseManager.Tests.ps1
- docs\Reseed-TestSite.ps1
- docs\cmdlets\export-spcreport.md
- Public\License\Get-SPCLicenseInfo.ps1
- Tests\Unit\Remove-SPCOrphanedUser.Tests.ps1
- docs\Sign-Module.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.1.6 (current version) | 5 | 6/27/2026 |