Monday, March 31, 2014

Restart SharePoint Timer Service Remotely using PowerShell

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!

To Restart SharePoint Timer service using PowerShell, 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)

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'"
    start-sleep -s 5
    start-sleep -s 5
Restart Timer Service on all Servers:
#Get the Farm
$Farm = Get-SPFarm

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

Restart Timer Service from command line:
net stop SPTimerV4
net start SPTimerV4

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...