SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to remove all Mysite newsfeed comments via powershell in preparation for a new site release (getting debugging and test comments out, etc.)...

I am using the Remove-SPSocialItemByDate powershell command ( and following multiple examples found there and in the Powershell for sharepoint 2013 How-To... but I consistently get the same error.


Add-PsSnapIn Microsoft.SharePoint.PowerShell
##This script removes comments, ratings and tags made before EndDate value
$userProfProxy = Get-SPServiceApplicationProxy | where { $_.DisplayName -eq 'User Profile Service Application' }
Remove-SPSocialItemByDate -ProfileServiceApplicationProxy $userProfProxy -RemoveComments 1 -EndDate 7/1/2014


Name Type Id
---- ---- --
User Profile Serv... User Profile Serv... 08d859ab-14e6-45a0-80cb-e2c74c312422

Remove-SPSocialItemByDate : Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query without specifying any hints and without using SET FORCEPLAN. At line:7 char:1 + Remove-SPSocialItemByDate -ProfileServiceApplicationProxy $userProfProxy -Remove ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Offic...moveSocialItems:SPCmdletRemoveSocialItems) [Remove-SPSocialItemByDate], SqlException + FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletRemoveSocialItems

share|improve this question

Try this.

Add-PsSnapIn Microsoft.SharePoint.PowerShell
$userProfProxy = Get-SPServiceApplicationProxy | where { $_.DisplayName -eq 'User Profile Service Application' }
Remove-SPSocialItemByDate -RemoveComments 1 -ProfileServiceApplicationProxy $userProfProxy -EndDate 7/1/2014

To remove tag

Remove-SPSocialItemByDate -RemoveTags 1 -ProfileServiceApplicationProxy c6681d53-e6c4-432f-9f31-22d3de81b00c -EndDate 9/15/2009
share|improve this answer
Maybe I'm not seeing correctly, but this looks just like the code that I posted that is not working. – Robbie Jul 4 '14 at 17:11
the order is different. The code that i posted is state -RemoveComment before -ProfileServiceApplicationProxy – Supermode Jul 7 '14 at 0:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.