Skip to content

Installation

Requirements

Requirement Minimum version
PowerShell 7+
PnP.PowerShell 2.0.0 (tested on 3.2.0)
Microsoft.Graph.Authentication 2.0.0 (tested on 2.38.0)
SharePoint Online role Site Collection Administrator (single site) or SharePoint Administrator (all sites)
Entra ID role At least User Administrator (read-only scan)

Install dependencies

Install-Module PnP.PowerShell                 -Scope CurrentUser -Force
Install-Module Microsoft.Graph.Authentication -Scope CurrentUser -Force

Install SPClean

Install-PSResource -Name SPClean
Install-Module -Name SPClean

PSGallery PSGallery Downloads

Install from source

# Import directly from the cloned repo
Import-Module .\SPClean\SPClean.psd1 -Force

# Or copy to your module path for auto-load
Copy-Item .\SPClean -Destination "$HOME\Documents\PowerShell\Modules\SPClean" -Recurse
Import-Module SPClean

Verify the import

Get-Command -Module SPClean

Expected cmdlets:

Connect-SPCTenant
Disconnect-SPCTenant
Get-SPCOrphanedUser
Export-SPCReport
Remove-SPCOrphanedUser
Restore-SPCOrphanedUser
New-SPCScanSchedule
Register-SPCLicense
Get-SPCLicenseInfo

Next step

Set up authentication →