if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$siteUrl = "https://xx/applications/Test"
$userName = "contosso\admin"
# Load site and user profile service
$site = Get-SPWeb $siteUrl
$serviceContext = Get-SPServiceContext($site.site)
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
if ($profileManager.UserExists($userName)) {
# Load user profile
$userProfile = $profileManager.GetUserProfile($userName)
# Load social following manager
$followingManager = New-Object Microsoft.Office.Server.Social.SPSocialFollowingManager($userProfile, $serviceContext)
# Prepare following object
$actorInfo = New-Object Microsoft.Office.Server.Social.SPSocialActorInfo
$actorInfo.ContentUri = $site.Url
$actorInfo.AccountName = $userProfile.AccountName
$actorInfo.ActorType = "Site"
# Add to followed sites
$followingManager.StopFollowing($actorInfo)