.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Export SharePoint User Profile information using powershell

Posted By:Sagar Pardeshi       Posted Date: March 04, 2015    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

SharePoint User Profile Information to CSV using powershell


In this Article we explore Sometimes we need to retrieve the synchronized users information details from SharePoint User Profile. Using power-shell, we can easily export all the user profile information details to csv format.

$siteUrl = "http://SPDev:9999/sites/Dept" 
$outputFile = "D:\sharepointprog_user_profiles.csv"
 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 $serviceContext = Get-SPServiceContext -Site $siteUrl 
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext);
 $profiles = $profileManager.GetEnumerator() $userProfileFields = @(            
$collection = @() foreach ($profile in $profiles) { 
Write-Host $profile.AccountName   
 $user = "" | select $userProfileFields   
 foreach ($field in $userProfileFields) {   
   if($profile[$field].Property.IsMultivalued) {
        $user.$field = $profile[$field] -join "|"      
} else {  
      $user.$field = $profile[$field].Value 
  $collection += $user
 $collection | Export-Csv $outputFile -NoTypeInformation 
$collection |  Out-GridView 

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend