Skip to content

Instantly share code, notes, and snippets.

@wictorwilen
Created February 4, 2015 11:21
Show Gist options
  • Save wictorwilen/4f40541a78b54951ebb7 to your computer and use it in GitHub Desktop.
Save wictorwilen/4f40541a78b54951ebb7 to your computer and use it in GitHub Desktop.
Reset SharePoint Cache on all servers in the farm
asnp microsoft.sharepoint.powershell
Get-SPServer | ?{$_.Role -eq "Application"} | %{
Write-Host -ForegroundColor Green "Updating $_ ..."
Invoke-Command -ComputerName $_.Name {
Stop-Service SPTimerV4
Stop-Service SPAdminV4
Get-ChildItem $env:ALLUSERSPROFILE\Microsoft\SharePoint\Config | ?{$_.Name.Contains("-")} | Get-ChildItem | ?{$_.Extension -eq ".xml"} | Remove-Item
$ini = Get-ChildItem $env:ALLUSERSPROFILE\Microsoft\SharePoint\Config | ?{$_.Name.Contains("-")} | Get-ChildItem | ?{$_.Extension -eq ".ini"}
"1" | Set-Content $ini.FullName
Start-Service SPTimerV4
Start-Service SPAdminV4
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment