Generate userprofile information PowerShell Script SharePoint 2013

InfoPath alternatives for form designing SharePoint

The script will generate the userprofile information. UserInfor.CSV and Ps file need to placed in same folder.

Also check out some of my posts on:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$siteUrl = “http://****.****.com/”
$outputFile = $(“$dp0\UserInfo.csv”)
$serviceContext = Get-SPServiceContext -Site $siteUrl
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext);
$profiles = $profileManager.GetEnumerator()
$collection = @()
foreach ($profile in $profiles) {
   $profileData = “” |
   select “AccountName”, “PreferredName”
   #$ADUser = Get-ADUser -Filter {SamAccountName -eq $profile.Name}
   $profileData.AccountName = $profile[“AccountName”]
   $profileData.PreferredName = $profile[“PreferredName”]
   #$collection += $profileData | ConvertTo-Html -Fragment
   $collection += $profileData
}
$collection | Export-Csv $outputFile -NoTypeInformation
Thanks,
Sambita

Similar SharePoint 2013 Tutorials


About Sambita Rath

I have 9 years of exprience into SharePoint implementation, architecture, Administrator, development and Training.Designing Information Architecture in SharePoint 2007, 2010,2013 and Office 365.

View all posts by Sambita Rath →

Leave a Reply