Wie lange in einem Newsfeed zurück in die Vergangenheit navigiert werden kann, hängt von zwei Parametern ab. Inspiriert von einem Skript mit dem anschließenden Repopulation des FeedCache von http://www.von-borries.ch/blog/Lists/Posts/Post.aspx?ID=86 hier die angepasste Version mit einigen Verbesserungen:
[code language="powershell"] #VARIABLES #-------------------------------------------------------------- $feedcachetimeinhours = 720 #default_value = 168 $mysite = "http://mysitehost.contoso.com" $loglocation = "C:\temp\repopulate.txt" $iisreset = $false $user = whoami #This user needs to have FullControl on UPSA (Admin and Connection Rights); although it needs local admin rights on all SharePoint Servers #-------------------------------------------------------------- clear write-host -f yellow "Loading SharePoint PS SnapIn if needed..." Add-PSSnapin microsoft.sharepoint.powershell –ea SilentlyContinue write-host -f yellow "Updating FeedCache Time" $upa = Get-SPServiceApplication | where {$_.TypeName -Like "User Profile Service Application"} $upa.FeedCacheTTLHours = $feedcachetimeinhours $upa.FeedCacheLastModifiedTimeTtlDeltaHours = $feedcachetimeinhours $upa.Update() write-host -f yellow "Get UPS Proxy" $UPSProxy = Get-SPServiceApplicationProxy | ?{$_.typename -like "*user*"} write-host -f yellow "Get User Profiles" $ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext((get-spsite $mysite)) $ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext) $AllProfiles = $ProfileManager.GetEnumerator() $tabName = "Issues" $table = New-Object system.Data.DataTable "$tabName" $col1 = New-Object system.Data.DataColumn Account,([string]) $col2 = New-Object system.Data.DataColumn ErrorMessage,([string]) $table.columns.add($col1) $table.columns.add($col2) $table.colum $i=0 write-host -f yellow "Updating FeedCache for each User Profile" write-host -f yellow " This shouldn't take long... :-)" foreach($profile in $AllProfiles) { if ($i % 50 -eq 0) {write-host "." -NoNewline} $AccountName = $profile.AccountName if ($profile.FeedIdentifier -ne $null) { try { write-host "" write-host " " $AccountName "> " -f green -nonewline Update-SPRepopulateMicroblogFeedCache -ProfileServiceApplicationProxy $UPSProxy -AccountName $AccountName -ErrorAction stop } catch { $ErrorMessage = $_.Exception.Message write-host $AccountName -fore red write-host $ErrorMessage -fore yellow $row = $table.NewRow() $row.Account = $AccountName $row.ErrorMessage = $ErrorMessage $table.Rows.Add($row) } } $i++ } if ($table.Rows.Count -gt 0) { $table | fl Account,ErrorMessage write-host "Check the listet Issues" -f Red write-host "Try to reexecute the command: Update-SPRepopulateMicroblogFeedCache -ProfileServiceApplicationProxy UPSProxy -AccountName AccountName" -f Red write-host "A list of these accounts has also been stored @" $loglocation -f Yellow $table | Out-File $loglocation pause } write-host "******************************** FINISHED ********************************" -BackgroundColor green -ForegroundColor Black write-host "Goto your MySite and check if the activty feeds are listed as expected" -f green write-host "URL: $mysite" -f green [/code]
Schreibe einen Kommentar