Skip to content

andificus/sharepoint-admin-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SharePoint Admin Scripts

PowerShell scripts for SharePoint Online administration, permissions auditing, and access control using the PnP PowerShell module.

Built to solve real SharePoint admin problems — terminated users retaining access, runaway external sharing, and permissions that are impossible to audit.


📁 Structure

Folder Purpose
Permissions/ Permissions auditing and cleanup
Auditing/ Site and file access reporting
Users/ User access management and offboarding
Configuration/ Site settings and sharing configuration

⚙️ Requirements

  • Windows PowerShell 5.1+ or PowerShell 7+
  • PnP PowerShell module
  • SharePoint Admin credentials

Install the PnP module if you haven't already:

Install-Module PnP.PowerShell -Scope CurrentUser

📌 Scripts

Permissions

  • Get-BrokenPermissionInheritance — Find all items with broken permission inheritance
  • Reset-BrokenInheritance — Restore broken inheritance back to parent permissions
  • Get-OrphanedPermissions — Find permissions assigned to users no longer in Azure AD
  • Copy-SharePointPermissions — Copy permissions from one user to another

Auditing

  • Audit-SitePermissions — Full permissions report across all sites
  • Get-ExternalSharingReport — Find all files shared externally or with unauthorized users

Users

  • Get-TerminatedUserPermissions — Find disabled AD users who still have SharePoint access
  • Remove-UserFromSharePoint — Remove a user from all SharePoint sites in one shot

Configuration

  • Set-SitePermissionDefaults — Lock down default sharing settings to prevent oversharing

🔧 Common Problems These Scripts Solve

  • Terminated employees retaining SharePoint access after offboarding
  • Files and folders shared with external or unauthorized users
  • No visibility into who has access to what across sites
  • Default sharing settings allowing users to share with anyone

🤝 Contributing

Feel free to fork and submit PRs. Scripts should be well-commented and include a usage example at the top.

About

PowerShell scripts for SharePoint Online administration, permissions auditing, and access control using the PnP PowerShell module.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors