Here is a little script I developed to clear the SharePoint Timer Job cache which sits in the %ALLUSERSPROFILE%\Microsoft\SharePoint\Config\{guid} directory. You often need to do this when deploying sites and generally doing stuff within SharePoint to prevent random OWSTIMER issues that interfere with your junk.
I use another script that stops and restarts all SharePoint services so stopping the SharePoint Timer Job Service is not part of this script. You may want to edit this script to stop this service at the beginning and start it again at the end. It's a one-liner to do...
$timerServiceName = "SharePoint 2010 Timer";
$timerService = Get-Service -Name $timerServiceName
if ($timerService.Status -eq "Running")
{
Write-Host -ForegroundColor Red $timerServiceName "is still running";
Break
}
$configDb = Get-SPDatabase | ? {$_.TypeName -eq "Configuration Database"}
$guid = $configDb.Id
Remove-Item "$env:AllUsersProfile\Microsoft\SharePoint\Config\$guid\*.xml"
Set-Content "$env:AllUsersProfile\Microsoft\SharePoint\Config\$guid\cache.ini" "1"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment