Export user information from site user information list

M365 PowerShell PowerShell For SharePoint Online SharePoint Online

In today’s article I will show you how easily we can use PowerShell to get data about a specific user in SharePoint Online enviroment .We will get information from site user information list

First, in the PowerShell that follows, we need to enter our Tenant’s admin site and run it with administrator privileges

The export of the data for this particular user will be done to a specific Path locally on our computer in the form of an excel

#Initialisation of Parameters
$Sites = "https://mydomain-admin.sharepoint.com"

#Connect to SharePoint Online
Connect-SPOService -Url $Sites

#Excecute the action
$sites = Get-SPOSite -IncludePersonalSite $true
$user = "user@mydomain.onmicrosoft.com"
foreach ($site in $sites)
{Export-SPOUserInfo -LoginName $user -site $site.Url -OutputFolder "C:\SharePoint_Demo"}

and finally we have the result in our excel file

For more information about this action you can visit the official site of Microsoft in Microsoft Learn