I needed to modify "Activities I want to share in my newsfeed" value centrally for all users in a SharePoint 2013 farm.
With the following PowerShell, you can set all options checked.
$Site = Get-SPSite -Limit 1
$ServiceContext = Get-SPServiceContext($Site)
$ProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
$Profiles = $ProfileManager.GetEnumerator()
foreach ($Profile in $Profiles)
# 4095 is decimal value of 111111111111, meaning all options are checked.
# Binary value describes what options are checked
# so 000000000001 --> 1 (1 being the value you want to set as the field value
# would mean only "Participation in communities" would be checked
$Profile["SPS-PrivacyActivity"].Value = 4095
Technorati Tags: SharePoint 2013
thank you for that post...
I tried to use the script but got the following error. Can you help?
New-Object : Ausnahme beim Aufrufen von ".ctor" mit 1 Argument(en):
UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does
not have 67432d2a-6d29-4cb4-a7a0-e617b565d5f3"
In C:\temp\NeewsfeedSettings.ps1:4 Zeichen:19
+ $ProfileManager = New-Object
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Make sure the account you run the PowerShell script with has Full Control permission on the User Profile Service Application. Alternatively log in and run the script with account that has such permissions.
I ran the Shell as farm admin and it works. great!
Hi, how can i target users in a specific AD group with this script?ReplyDelete
SharePoint User Profile Service doesn't know anything about AD groups so you need to fetch AD group user account names first, then do a for each loop to modify each user profile one by one.Delete
Great post. Works for me.ReplyDelete
The binary number sequence is other way around. e.g. If you want to mark only Participation in communities, you will have to provide value 2048 (100000000000). Tested in SP2013.
Thank you Xeeshan for the update. Much appreciated!Delete
Do you know of a way I can do this in SharePoint Online?ReplyDelete
Have you tried this which lists properties including this, and modify it to update the value? https://gallery.technet.microsoft.com/office/Retrieve-all-SharePoint-357e2936#contentReplyDelete
omg thank you so much! there is absolutely no documentation about this, and every blog about the old outdated 2010 Feed wich is done entirely different.ReplyDelete
this helps me really a lot, even years later, hahah.