Introduction
The following script will help make everyone in the user profile follow a single user. We sometimes receive requests from clients where they want a certain account to be followed by everyone. In that case, the below script will be very helpful.
- Add-PSSnapin microsoft.sharepoint.powershell -EA SilentlyContinue
- $site = Get-SPSite "any site collection url"
- $serviceContext = Get-SPServiceContext($site)
- # Represents a collection of UserProfile objects that are used to access user profile data.
- $profileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
- $profiles = $profileManager.GetEnumerator()
- foreach ($profile in $profiles)
- {
- Write-Host $Profile.AccountName "|" $Profile.DisplayName;
- #Initializes a new SPSocialFollowingManager instance for the specified user and service context.
- $followingManager = New-Object Microsoft.Office.Server.Social.SPSocialFollowingManager($profile, $serviceContext)
- # Create a new social actor object for the User to follow
- $socialActor = New-Object Microsoft.Office.Server.Social.SPSocialActorInfo
- $socialActor.AccountName = "Domain\username" # Provide the user account details which should be followed by everyone
- $socialActor.ActorType = [Microsoft.Office.Server.Social.SPSocialActorType]:: User
- $followingManager.Follow($socialActor)
- }
Thank you! Please post your queries in case of any issue,
Saurav

Join the conversation! Your thoughts help the community grow.