Viewing permissions on a Sharepoint Online site with Powershell

If you want to use the Sharepoint Online Management Shell module for Powershell to view user permissions on your Sharepoint Online site, start a Powershell window as admin. If you’re not running as admin you’ll have to add the module path to your environment variable like this:

$env:PSModulePath += ";C:\Program Files\SharePoint Online Management Shell\"

Then load the SPO module:

Import-Module Microsoft.Online.SharePoint.PowerShell

And connect to your sharepoint tenant:

Connect-SPOService -Url https://contoso-admin.sharepoint.com
get-spouser -site https://contoso.sharepoint.com/sites/MyDemoSite

Now build the list of users with access. Please note, the exact access type isĀ NOT specified, this Powershell module does not yet support retrieving explicit permissions.

If you see the following error, you are not running as admin, did not install the module or did not add the correct module path to your environment variables:

Import-Module : The specified module 'Microsoft.Online.SharePoint.PowerShell' was not loaded because no valid module
file was found in any module directory.
At line:1 char:1
+ Import-Module Microsoft.Online.SharePoint.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Microsoft.Online.SharePoint.PowerShell:String) [Import-Module], Fi
leNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Greg
Greg
2 years ago

Thank you so much!