PoshCode Logo PowerShell Code Repository

  1. Update all fast running (1 minute) timerjobs to run onece every 30+ minutes instead

  1.  
  2.  
  3. ## Update all fast running (1 minute) timerjobs to run onece every 30+ minutes instead
  4. ## Jos Verlinde
  5. ## Version 1 - Sharepoint 2010 B2
  6.  
  7. $Jobs = @(Get-SPTimerJob | Where-Object { $_.Schedule.Interval -le 5 -and $_.Schedule.Description -eq "Minutes" })
  8. if ( $Jobs.count -GT 0 ) {
  9.     ## Add 30 mintues to all these timerjobs
  10.     foreach ($job in $Jobs) {
  11.         Write-Host -foregroundcolor green $job.name
  12.        
  13.         $Sched = $job.Schedule
  14.         $Sched.Interval= $Sched.Interval+30
  15.         $job.Schedule=$Sched
  16.         $job.Update()
  17.     }
  18.  
  19.     Get-SPTimerJob | Where-Object {  $_.Schedule.Description -eq "Minutes" }
  20. } else {
  21.     Write-Host -foregroundcolor green "No fast running timerjobs found"
  22. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me