• vadim@workflowexcellence.com
  • Utah, United States

Nintex Workflow – PowerShell Find All Workflows Part 1

There are times when you need to find all your workflows in your entire farm.  Nintex Workflow installs a command line tool named NWAdmin.exe on the server where you initially ran the MSI.  It’s usually located in c:\Program Files\Nintex\Nintex Workflow 2010 (or 2007 if you are on that product).

NWAdmin has a number of operations, but for this post we are interested in the -o FindWorkflows operation.  It iterates through the farm and outputs the site, list and workflowname.

The output looks like this:

Active at http://ntx-vadim3:10000

— First List
—- 3 Child Actions Workflow
—- AutoWorkflow1
—- Dont Log Workflow
—- Dummy Actions Workflow
—- First UDA Workflow
—- First Workflow
—- For Each with 1 Action Workflow
—- ForEach 10 Iterations Workflow
—- ForEach 100 Iterations Workflow
—- ForEach 1000 Iterations Workflow
—- TriState Machine Workflow

It’s a nice format and quite legible.

The goal here, is to parse this information so that we can eventually do something with it.

I wrote the following PowerShell script that will run the NWAdmin command, then parse the output so that later one, we can extend the script to do more interesting things.

[IO.Directory]::SetCurrentDirectory((Convert-Path (Get-Location -PSProvider FileSystem)))

# check if we are in the same location as the nwadmin.exe
if(Test-Path(“.\nwadmin.exe”))
{
  # find all the workflows and store them in a variable
  $foundworkflows = .\nwadmin -o FindWorkflows

  foreach($line in $foundworkflows)
  {
    if($line.StartsWith(“Active at “))
    {
      # get the site url
      $site = $line.Replace(“Active at “,””);
    }
    if($line.StartsWith(“– “))
    {
      # get the list name
      $list = $line.Replace(“– “,””);
    }
    if($line.StartsWith(“—- “))
    {
      # get the workflow name
      $workflowname = $line.Replace(“—- “,””);

      $message = “{0} – {1} – {2}” -f $site,$list,$workflowname;
      echo $message;
    }
  }
}
else
{
  echo “NWAdmin doesn’t exist.  Change directory to where NWAdmin.exe lives.”;
}

In the script, later on, we will replace the lines :

  $message = “{0} – {1} – {2}” -f $site,$list,$workflowname;

  echo $message;

With something a little more useful.

The output of the above script is :

http://ntx-vadim3:10000 – First List – 3 Child Actions Workflow
http://ntx-vadim3:10000 – First List – AutoWorkflow1
http://ntx-vadim3:10000 – First List – Dont Log Workflow
http://ntx-vadim3:10000 – First List – Dummy Actions Workflow
http://ntx-vadim3:10000 – First List – First UDA Workflow
http://ntx-vadim3:10000 – First List – First Workflow
http://ntx-vadim3:10000 – First List – For Each with 1 Action Workflow
http://ntx-vadim3:10000 – First List – ForEach 10 Iterations Workflow
http://ntx-vadim3:10000 – First List – ForEach 100 Iterations Workflow
http://ntx-vadim3:10000 – First List – ForEach 1000 Iterations Workflow
http://ntx-vadim3:10000 – First List – TriState Machine Workflow

Note

You need to run this script in the folder that contains the NWAdmin.exe or modify the script.

Downloads

Nintex Workflow 2010 : v2.3.5.0

Download the AllWorkflowsV1 PowerShell script

Leave a Reply

Your email address will not be published. Required fields are marked *