SHARE
TWEET

SharePoint 2013 Repopulating newsfeed cache script

kawie95 Aug 13th, 2015 384 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $proxy  = Get-SPServiceApplicationProxy | ? {$_.Name -ilike "User Profile Service Application*"}
  2. Update-SPRepopulateMicroblogLMTCache -ProfileServiceApplicationProxy $proxy
  3.  
  4. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
  5. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles")
  6.  
  7. $url = "http://mysiteurl.domain.com"
  8. $contextWeb = New-Object Microsoft.SharePoint.SPSite($url);
  9. $ServerContext = [Microsoft.Office.Server.ServerContext]::GetContext($contextWeb);
  10.  
  11. $UserProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServerContext);
  12.  
  13. $Profiles = $UserProfileManager.GetEnumerator();
  14.  
  15. foreach ($oUser in $Profiles ) {
  16.     if ($oUser.item("SPS-PersonalSiteCapabilities").Value -eq 14 ){
  17.         $personalurl = $url + $oUser.item("personalspace").Value
  18.         Write-Host $oUser.item("AccountName").Value
  19.         Update-SPRepopulateMicroblogFeedCache -ProfileServiceApplicationProxy $proxy -accountname $oUser.item("AccountName").Value
  20.         #-siteurl $personalurl
  21.     }
  22. }
  23.  
  24. $contextWeb.Dispose()
RAW Paste Data
Top