SharePoint Timer service must be restarted for certain configuration changes in SharePoint administration activities. Well, without logging into each and every SharePoint server and restarting timer service, we can utilize PowerShell to do it remotely!
PowerShell Script to Restart SharePoint Timer Service Remotely:
You can also use the classic WMI method to restart any service on remove server:
PowerShell Script to Restart SharePoint Timer Service Remotely:
#Service to Restart
$ServiceName = "SPTimerV4"
#Array to Hold server Names. Update this Array accordingly
$ServerNames = @("SPServer01", "SPServer02", "SPServer03")
#Get All SharePoint Servers and restart their SharePoint Timer service
foreach($Server in $ServerNames)
{
Restart-Service -InputObject $(Get-Service -Computer $Server -Name $ServiceName)
}
You can also use the classic WMI method to restart any service on remove server:
#Server Name
$ServerName = "SPServer01"
#Service to Restart
$ServiceName = "SPTimerV4"
#Get Timer Service
$Service = Get-WmiObject -computer $ServerName Win32_Service -Filter "Name='$ServiceName'"
$Service.InvokeMethod('StopService',$Null)
start-sleep -s 5
$Service.InvokeMethod('StartService',$Null)
start-sleep -s 5