[array]$servers= Get-SPServer | ? {$_.Role -eq "Application"} $farm = Get-SPFarm foreach ($server in $servers) { Write-Host "Restarting Timer Job on $server" $Service = Get-WmiObject -Computer $server.name Win32_Service -Filter "Name='SPTimerV4'" if ($Service -ne $null) { $Service.InvokeMethod('StopService',$null) Start-Sleep -s 7 $service.InvokeMethod('StartService',$null) Start-Sleep -s 7 Write-Host "Timer Job successfully restarted on $server" } else { write-host -ForegroundColor Yellow "Could not find SharePoint 2010 Timer Service on $server" } }