I want to retrieve all the user email id, display name, user name & Title from user information list using power shell


You can use the below PowerShell script:

function ExtractSPuserInformationListToCSV()

        [Parameter(Mandatory=$true)] [string] $SiteURL


    $web = Get-SPWeb $SiteURL
    $list = $web.Lists["User Information List"]  

    $spQuery = New-Object Microsoft.SharePoint.SPQuery  

    $CamlQueryString = '<Query><OrderBy><FieldRef Name="Title" Ascending="True" /></OrderBy></Query>'  

    $spQuery.Query = $CamlQueryString  

    $userInformationListItemsColls = $list.GetItems($spQuery)  

foreach($oneUserInInformationList in $userInformationListItemsColls) 

    Write-Host $oneUserInInformationList.Title 

    $userData = Get-SPUser -Web $web.URL -Identity $oneUserInInformationList["ows_Name"]

    $UserInformationlistItemData = @{
    "Display Name" = $userData.DisplayName
    "User Login" = $userData.UserLogin
    "Email" = $userData.Email
    "Name" = $userData.Name

New-Object PSObject -Property $UserInformationlistItemData


return $UserInformationlistItemData


#Call the function like below

ExtractSPuserInformationListToCSV "YourSiteURL" | Export-Csv -NoTypeInformation -Path "Your CSV Path";
  • Hi - if it has helped you, could you please [Upvote(^)] and mark as answered. Jun 19 '20 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.