Export-UserInfo
SharePoint Online: Exports user info
#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$LoginName,
[Parameter(Mandatory = $true)]
[string]$OutputFolder,
[Parameter(Mandatory = $true)]
[string]$Site
)
Process {
try {
$cmdArgs = @{ ErrorAction = 'Stop'; LoginName = $LoginName; OutputFolder = $OutputFolder; Site = $Site }
Export-SPOUserInfo @cmdArgs | Out-Null
[PSCustomObject]@{ Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"; Status = "Success"; Message = "User info exported for '$LoginName' to '$OutputFolder'" }
}
catch { throw }
}Login name of the user to export
Target folder where the CSV file is generated
URL of the site collection