Restart SharePoint Timer Service Remotely using PowerShell

SharePoint Timer service must be restarted for certain configuration changes in SharePoint administration activities. To restart timer service in SharePoint, follow these steps:
  • Login to your SharePoint Web Front End Server(s)
  • Open Services console ( Start >> Run >> Services.msc)
  • From the "Services" console, Find "SharePoint Timer Service". Right click and choose "Restart" from the Menu.
    restart sharepoint timer service using powershell
Restart SharePoint Timer Service using PowerShell:
Well, without logging into each and every SharePoint server and restarting timer service, we can utilize PowerShell to do it remotely! Use:
Restart-Service sptimerv4

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)
 }

How to restart timer service using WMI method:
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

Restart SharePoint Timer Service on all Servers:
To restart timer service on all servers using PowerShell,
#Get the Farm
$Farm = Get-SPFarm

#Get all Timer Job instances and restart
$Farm.TimerService.Instances | foreach { $_.Stop(); $_.Start(); }

Restart SharePoint Timer Service from command-line:
From the command prompt, Enter:
net stop SPTimerV4
net start SPTimerV4
Restart SharePoint Timer Service Remotely using PowerShell Restart SharePoint Timer Service Remotely using PowerShell Reviewed by Salaudeen Rajack on March 31, 2014 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.