A list of all users can be generated using Get-SPOUser command in SharePoint Online Management Shell. Multiple parameters are available to be used with the cmdlet with detail as follows.
SITE
Site Parameter is mandatory and must be given for successful completion of the command. If only Site parameter is used, it will return all the user/groups for site mentioned against this parameter.
Example:
GROUP
If group parameter is used along with Site parameter, it will return all users in that group.
Exampe:
SITE
Site Parameter is mandatory and must be given for successful completion of the command. If only Site parameter is used, it will return all the user/groups for site mentioned against this parameter.
Example:
Get-SPOUser -Site https://shaoib.sharepoint.com
LOGINNAME
Login Name parameter retrieves the details of account mentioned in command.
Example:
Get-SPOUser -Site https://shaoib.sharepoint.com -Loginame "test@onmicrosoft.com"
GROUP
If group parameter is used along with Site parameter, it will return all users in that group.
Exampe:
Get-SPOUser -Site https://shaoib.sharepoint.com -Group "Dev Users"
Export Users
Using below PowerShell Function, List of all users/groups can also be exported into a CSV file.
Function GetSiteUsers() {
$USers = Get-SPOUser -Site <SiteURL>
$Users | Export-Csv "C:\SiteUsers.csv" -notype
}
Exported File:
No comments:
Post a Comment