There are 2 services in SharePoint with the user Profile Service and the Users Profiles synchronization service, which Service is a prerequisite for user profile Serivce application to work.
User Profile Synchronization Service: used to synchronize AD account information to SharePoint Farm (actually to user profiles), we Service application creates a user profile-related database
User Profile Service: used to host the normal operation of the user Profile Service application.
The User Profile Service application only imports data (by configuring configure synchronization Connections) and does not provide an export data interface.
It is also not flexible to import data, such as we just want to import specific data, not the entire ad, for this particular requirement through PowerShell can be resolved.
As for how to start the User Profile Service and the user Profiles synchronization Servie, configure the User Profile Service Application This article does not elaborate
The learning goal of this article is: How to use PowerShell to import and export user information
- Powershell Import users to user Profile service
$path= ' C:\userlist.csv '$site=$CAURL $context= Get-spservicecontext-Site $site $web= Get-spweb-Identity $siteTry{$UPM= New-object-typename Microsoft.Office.Server.UserProfiles.UserProfileManager-argumentlist $context}Catch{} if($UPM-ne $NULL) {$userslist= Import-csv-Path $path $r=1; for($count =0; $count-lt $userslist. Count; $count + +) {$user _name= $domain +"\ "+ $userslist [$count]. Userid-replace" ", "" if($UPM. UserExists ($user _name)) {}Else { Try{$profileproperty=$UPM. Createuserprofile ($user _name) $profileproperty [ "Manager"]. Value=' $profileproperty [Mail]. value= " $profileproperty ["Title"]. Value=" $profileproperty. Commit ()}Catch{Write-host-f Red ([String]::format ("{0} not Exist", $user _name)); } } } }
- Powershell exports users from the user profile Service
$SITEURL ="CA URL"$outputFile="C:\sharepoint_user_profiles.csv"$serviceContext= Get-spservicecontext-Site $siteUrl $profilemanager= new-Object Microsoft.Office.Server.UserProfiles.UserProfileManager ($serviceContext); $profiles=$profileManager. GetEnumerator () $collection= @()foreach($profileinch$profiles) {$profileData=""|Select "AccountName","Preferredname","Manager","Office"," Location","Workemail","Assistant","Aboutme","Language","Pictureurl","Role"$profileData. AccountName= $profile ["AccountName"] $profileData. Preferredname= $profile ["Preferredname"] $profileData. Manager= $profile ["Manager"] $profileData. Office= $profile ["Office"] $profileData. location= $profile [" Location"] $profileData. Workemail= $profile ["Workemail"] $profileData. Assistant= $profile ["Assistant"] $profileData. Aboutme= $profile ["Aboutme"]. Value $profileData. Language= $profile ["Language"] $profileData. Pictureurl= $profile ["Pictureurl"] $profileData. Role= $profile ["Role"] # $collection+ = $profileData | Convertto-html-Fragment $collection+=$profileData} $collection| Export-csv $outputFile-notypeinformation-encoding"UTF8"
Import and Export users from user profiles service by Powershell