Skip to content

Export-UserProfile

SharePoint Online: Exports user profile data

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$LoginName,
    [Parameter(Mandatory = $true)]
    [string]$OutputFolder
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; LoginName = $LoginName; OutputFolder = $OutputFolder }
        Export-SPOUserProfile @cmdArgs | Out-Null
        [PSCustomObject]@{ Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"; Status = "Success"; Message = "User profile exported for '$LoginName' to '$OutputFolder'" }
    }
    catch { throw }
}

Login name of the user whose data is exported

Output folder location where the CSV file is created

An interactive directory of PowerShell scripts.