Nintex Workflow – PowerShell Find Workflows with Verbose Logging Enabled Part 5

This is Part 5 from the previous post on PowerShell Find Workflows that contain a Specific Action Part 4.

Added a new operation that looks in all the workflows to find those that have Verbose Logging enabled.

Operation is : FindVerboseLogging

Changes to the PowerShell Script

The way to export and publish a workflow is via a web service call to the site where the workflow lives. The Nintex Workflow web service url looks like this :

http://[siteurl]/_vti_bin/NintexWorkflow/Workflow.asmx

You can find some more information about this web service in the Nintex Workflow 2010 SDK.

I’ve added a new operation named “FindVerboseLogging”. What this script does, is it finds each workflow from the NWAdmin command, then connects to the web service running on that site and makes a call to the ExportWorkflow web method, and then it runs some Regular Expression over the exported workflow, to interrogate it and find out whether the workflow has Verbose Logging enabled.

How to run this PowerShell Script

Put the script file in to : c:\Program Files\Nintex\Nintex Workflow 2010

To run this script, open the SharePoint 2010 Management Shell.

Change directories to c:\Program Files\Nintex\Nintex Workflow 2010

Run the script to Find Workflows with an Action:

.\AllWorkflows.ps1 -nwoperation FindWorkflowsWithAction -nwlogin domain\username -nwpassword password -nwaction “actionname”

eg. to find all the workflows that contain the Math operation action

.\AllWorkflows.ps1 -nwoperation FindWorkflowsWithAction -nwlogin domain\username -nwpassword password -nwaction “Math operation”

Run the script to Export:

.\AllWorkflows.ps1 -nwoperation ExportAll -nwlogin domain\username -nwpassword password

Run the script to Republish:

.\AllWorkflows.ps1 -nwoperation RepublishAll -nwlogin domain\username -nwpassword password

Run the script to Find Workflows with Verbose Logging Enabled:

.\AllWorkflows.ps1 -nwoperation FindVerboseLogging -nwlogin domain\username -nwpassword password

Output

The output of this script call will be:

[siteurl] – [listname] – [workflowname]

This should be enough to get you to your workflow.

Conclusion

You should now be able to find which workflow contains a verbose logging.

Don’t be afraid to tweak this to add more features that you may need.

If you find that you get timeouts (eg. publishing large worfklows), there is a -nwtimeout parameter you can use to increase the timeout.

Notes

19th Feb 2014 (v4.4) – add find verbose logging.

29th Aug 2012 (v4.3) – add better support for parameters and web service timeout.

28th Aug 2012 (v4.2) – add support for Site Workflow, Reusable Workflow Templates and Site Collection Reusable Workflow Templates.

This script has not been tested with FBA or CBA.

28th Aug 2012 (v4.1) – I added some more error handling to this script. It will now stop the script on the first exception it gets, and it will output the web service url, the list and the workflowname. I’ve also added a line to accept SSL certificates. I have tested this with an SSL site, but only one. Let me know if you find anything.

If you come across an exception, and you want to test this out for a single specific site/list/workflow, then you can try this script. But you will need to type in the login, password, webservice url, list and workflowname:

try
{
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

$login = “”;
$password = “”;
$webserviceurl = “”;
$list = “”;
$workflowname = “”;

$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($login,$secpasswd);
$webserviceurl = $webserviceurl
$page = New-WebServiceProxy -Uri $webserviceurl -Credential $credential;
$page.Url = $webserviceurl;
$exportedworkflow = $page.ExportWorkflow($workflowname,$list,’List’);
$publishresult = $page.PublishFromNWFXml($exportedworkflow,$list,$workflowname,$True);
}
catch
{
echo $_;
}

Downloads

Nintex Workflow 2010 : v2.3.7.0

Download the AllWorkflows PowerShell script

Leave a Reply

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