Skip to main content
Nintex Community Menu Bar

Products: Nintex Workflow 2013, Nintex Workflow 2010

 

WARNING: THIS SHOULD NEVER BE USED IN A PRODUCTION ENVIRONMENT

 

When working on a workflow in a development environment it is often desirable to run through many instances of a workflow under various conditions. If the workflow utilizes pauses, this can be quite cumbersome when testing. This PowerShell script can be run on a development server to force the Workflow Timer job to run at a specified interval with no minimum (Example: 5 seconds) making testing a lot faster.

 

Since this script does not actually modify anything, it makes it easy to turn it off and on during your testing cycles.

 

PowerShell Script
  1. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
  2.  
  3. $job = $(Get-SPTimerJob -Identity 'job-workflow')
  4.  
  5. while($true)
  6. {
  7.     $job.RunNow()
  8.     Start-Sleep(10)
  9. }
 

To use the script do the following:

  • Ensure you are running the PowerShell console as a SharePoint Administrative account.
  • Configure the value in "Start-Sleep" to the interval the workflow timer job should run at.

Super helpful for testing, but please note the warning.


What he said! I am hoping this will help slow down cases we see where folks have modified the timer job definition schedule from the default 5 minutes.


This is awesome.   I can't tell you how many minutes of my life have been wasted waiting for those state machine changes.. LoL


I know right! That and demos... There is nothing quite like sitting there waiting on something that under normal circumstances would not matter as much...


Totally,  I always have to tell people in demos "well in real life 5 minutes is nothing..." but in testing and demoing, painful!


The script is a simple loop that will continually execute the timer job called "job-workflow" and in each iteration it does two things:

-executes the job-workflow timer job

-sleeps 10 seconds

The sleep is just probably intended to throttle the frequency that PowerShell executes the timer job as to not cause any contention with resources.

The actual schedule on the timer job in SharePoint isn't modified and this script will run until you stop it.  It's basically bypassing the original timer job schedule by executing it immediately in PowerShell.


Reply