PowerShell Script to Get SharePoint Site Permissions (2025 Guide)

  author
Written By Mohit Kumar Jha
Anuraag Singh
Approved By Anuraag Singh
Modified On July 28th, 2025
Reading Time 4 Minutes Reading

Managing SharePoint permissions manually can be time-consuming and error-prone. That’s why I use PowerShell to quickly extract, audit, and export SharePoint Online site permissions for better management. Here I will explain how to run a PowerShell script to get SharePoint site permissions step by step.

Table of Contents

Why I Use PowerShell to View SharePoint Permissions

If you’re reading this guide, you probably have your reasons to know about PowerShell scripts. But here are my:

  • Export permissions into readable formats like CSV
  • Identify users and groups with elevated access
  • Audit multiple sites in bulk
  • Maintain better control and visibility

Manually checking site permissions through the SharePoint UI can be time-consuming. Next, I’ll share the PowerShell scripts which is mentioned on the official Microsoft site, and I tried them. 

Prerequisites to Run a PowerShell Script to Get SharePoint Site Permissions Quickly

Here are some prerequisite steps which need to be followed before running any command: 

  • SharePoint Online Management Shell is installed.
  • Global admin or SharePoint admin rights are available.
  • Backup SharePoint Online to local storage
  • Connect to SharePoint Online using the following command:

connect sposervice

PowerShell Script to Get SharePoint Site Permissions

Here’s the basic PowerShell script I use to fetch permission details from a specific SharePoint Online site.

#1. Script to List All Users with Direct Permissions

PowerShell script to get SharePoint site permissions

#2. Export Permissions to CSV

To make the results more usable, export them to CSV using this enhanced script:

Export permissions to CSV

#3. Script for All Subsites & Libraries

In larger environments, I loop through all subsites and libraries using PnP PowerShell. Here’s an example:

Script for all subsites and libraries

Best Practices for Auditing SharePoint Permissions

  • Find users with Full Control and ensure they really need it.
  • Audit external sharing; some guest users may have more access than required.
  • Schedule this script monthly using Windows Task Scheduler to keep permissions in check.
  • If you’re handling a SharePoint Online tenant-to-tenant migration or restructuring, run this script before and after to validate access changes.

How to Ensure Permissions Stay Intact During SharePoint Migration?

Despite a PowerShell script to get SharePoint site permissions, if you’re planning to migrate SharePoint data between tenants or restructure permissions, it’s easier to combine permission reporting with SysTools SharePoint Online Migration Tool.

It will help to:

  • Migrate site content, lists, and libraries with full fidelity
  • Retain permissions, metadata, and structure
  • Generate pre- and post-migration reports for verification
  • 24/7 Technical Support

You can use the tool alongside this PowerShell method to ensure migrated permissions are accurate.

Author’s Verdict

As a SharePoint admin, I know how time-consuming and frustrating it is to manage permissions on multiple sites. That’s why I explained the PowerShell script to get SharePoint site permissions simultaneously, to help those who are like me. 

If you’re planning to migrate SharePoint list to another site or tenant, don’t forget to check out SysTools Migrator for a seamless experience.

People Also Ask

Q1. Can I get SharePoint permissions without admin rights?
No, you need SharePoint admin or site collection admin permissions to query roles using PowerShell.

Q2. What’s the difference between direct and inherited permissions?
Direct permissions are explicitly granted; inherited ones come from the parent site. PowerShell can reveal both with proper scripting.

Q3. Is PnP PowerShell better than the default SPO module?
PnP PowerShell is more flexible and suited for site-wide audits or reporting across subsites.

Q4. Can I use these scripts for SharePoint On-Premises?
Yes, but you’ll need to adapt the script to use Microsoft.SharePoint.PowerShell module instead of CSOM.

  author

By Mohit Kumar Jha

Mohit is a Microsoft Certified expert for all things Microsoft. He brings a unique perspective gained from nearly a decade of active participation in various IT forums, blogs, and social media. Known in admin circles as the go-to guru for solving user queries in the domain of cloud migration, data backup, and digital forensics. The secret to his core expertise lies in solving problems practically. Through this hands-on experience, he has acquired knowledge in diverse domains like Microsoft 365 Cloud, On-Premise Exchange Server, AD, and Entra ID. He regularly writes, edits, and shares his insights in plain, simple words for troubleshooting everything from common issues to major outages.