Republish site workflow through Powershell


Badge +2

So I have been testing the great script written by Vadim Tabakman (below) to republish workflows; but I am having issues with the Site Workflows.  I am using this on a SharePoint 2013 farm.

http://vadimtabakman.com/nintex-workflow-powershell-find-all-workflows-and-export-or-republish-part-3.aspx

All of the list workflows republish just fine but any site workflows do not get republished at all.  It seems that the web service is being called with the $list value of "Site Workflow" for these site workflows.  Has anyone run across this before or have any ideas?

The code that should be doing the work is:

$publishresult = $page.PublishFromNWFXml($exportedworkflow,$list,$workflowname,$True);

But I think that the $list value of "Site Workflow" is not found, so nothing happens.  Other than this, the script works great and is very helpful.  Thanks Vadim!

Any thoughts are appreciated.

Thank you for your time

Rob C


2 replies

Badge +2

So I might have found the solution for my issue.  I basically set the $list value to and empty string.

            switch($operation)

            {

              "RepublishAll"

              {

                # republish this workflow

                try

                {

                  if($list -eq "Site Workflow")

                  {

                    $list = "";

                  }

                  $publishresult = $page.PublishFromNWFXml($exportedworkflow,$list,$workflowname,$True);

                }

.......

In testing, the site workflows are now republishing.  Hopefully this helps others if they find themselves in the same boat.

Badge +6

Correct. [Guid]::Empty should work as well.

Reply