Title: Export User Profile Information to Excel
Description: Export the user profile information to Excell.
Description: Export the user profile information to Excell.
- # -----------------------------------------------------------------------------
- # Script : To Export User Profile Information Value in Excel and HTML
- #. Use Internal name of the user profile property.
- #. Any custom user fields will have "SPS-".
- #. Remove comment "#" in line 43 and do the same in line 48 if you need HTML output.
- #. Provide location after out-file to save the HTML file.
- #. In Line 59 use the same location as Out-File.
- #. Append if you have any custom fields in mysite user profile property
- #. For HTML look and feel please copy and paste the style.css in C:\.
- #. Use any style.css as per organization standard and policy.
- Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
- $siteUrl = "http://people.in.lakku.com"
- $outputFile = "E:\Temp\ProfileCount.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" , "TimeZone", "Birthday" , "AlternateEmail" , "AltMobile" , "SkypeName" , "HomePhone" , "Assistant" , "VoluntaryPositions" , "AssociationMemberships" , "PreviousEmployers" , "EducationHistory" , "Yammer" , "FaceBook" , "LinkedIn" , "Twitter" , "GooglePlus" , "YahooPulse" , "FourSquare" , "PhoneticName", "AskMe" , "Responsibilities" , "Manager" , "Interests" , "PastProjects" , "Skills" , "AboutMe" , "PreviousRolesAt"
- $profileData.AccountName = $profile["AccountName"]
- $profileData.PreferredName = $profile["PreferredName"]
- $profileData.TimeZone = $profile["SPS-TimeZone"]
- $profileData.Birthday = $profile["SPS-Birthday"]
- $profileData.AlternateEmail = $profile["AlternateEmail"]
- $profileData.AltMobile = $profile["AltMobile"]
- $profileData.SkypeName = $profile["SkypeName"]
- $profileData.HomePhone = $profile["HomePhone"]
- $profileData.Assistant = $profile["Assistant"]
- $profileData.VoluntaryPositions = $profile["VoluntaryPositions"]
- $profileData.AssociationMemberships = $profile["AssociationMemberships"]
- $profileData.PreviousEmployers = $profile["PreviousEmployers"]
- $profileData.EducationHistory = $profile["EducationHistory"]
- $profileData.Yammer = $profile["Yammer"]
- $profileData.FaceBook = $profile["FaceBook"]
- $profileData.LinkedIn = $profile["LinkedIn"]
- $profileData.Twitter = $profile["Twitter"]
- $profileData.GooglePlus = $profile["GooglePlus"]
- $profileData.YahooPulse = $profile["YahooPulse"]
- $profileData.Twitter = $profile["FourSquare"]
- $profileData.PhoneticName = $profile["PhoneticName"]
- $profileData.AskMe = $profile["SPS-Responsibility"]
- $profileData.Responsibilities = $profile["Responsibilities"]
- $profileData.Manager = $profile["Manager"]
- $profileData.Interests = $profile["SPS-Interests"]
- $profileData.PastProjects = $profile["SPS-PastProjects"]
- $profileData.Skills = $profile["SPS-Skills"]
- $profileData.AboutMe = $profile["AboutMe"].Value
- $profileData.PreviousRolesAt = $profile["PreviousRolesAt"]
- #$collection += $profileData | ConvertTo-Html -Fragment
- $collection += $profileData
- }
- #ConvertTo-Html -Body "$collection" -CssUri C:\style.CSS | Out-File "Location to save"
- $collection | Export-Csv $outputFile -NoTypeInformation
- #Send Mail to Box for easy access
- #$SMTP = "Name of the SMTP Server"
- #$From = "Email Address"
- #$To = "Email Address" , "Email Address"
- #$Subject = "User Profile Information Report"
- #Send-MailMessage -From $From -To $To -SmtpServer $SMTP -Subject $Subject -Attachments "Same as Out-File Location"