1

On SharePoint log folder so many ".usage" files are creating and not getting deleting. Due to space issue occurring. So We are restarting "SPTimerV4" service manually. We need to scheduled task scheduler job for restarting every half an hour. Could any please share powershell script how to restart "SPTimerV4" service using powershell . Highly appreciate your help.

Note: We are using single farm of SP 2010 and Task scheduler job creating we can do it.

2

It is very easy to restart timer service.

The 1st way

restart-service sptimerv4

The 2nd way

net stop SPTIMERV4
net start SPTIMERV4

Also you can check status of the service and start service only if service is stopped.

$ServiceName = 'sptimerv4'
$arrService = Get-Service -Name $ServiceName

while ($arrService.Status -ne 'Running')
{
    Start-Service $ServiceName
    write-host $arrService.status
    write-host 'Service starting'
    Start-Sleep -seconds 60
    $arrService.Refresh()
    if ($arrService.Status -eq 'Running')
    {
        Write-Host 'Service is now Running'
    }
}
  • Hi Raf, we need powershell script code which automatically restart SPTimerV4 service. – murali kuruva May 8 at 4:50
  • 1
    So, you can save code above as ps1. And create new scheduled task in Task Scheduler. And set to fire this script each 30 min. – Raf May 8 at 4:54
  • 1
    @Raf You should try to see what is causing the files not to be deleted. Restarting the timer service that often will create a horrible experience for your users as they will loose all their work and be disconnected every 30 minutes. – Christoffer May 8 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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