Solved

Powershell to Delete all Nintex Workflows permanently

  • 19 June 2023
  • 7 replies
  • 260 views

Badge +1

We want to take backup of all Nintex Workflows and Delete them using Powershell Scripts. We found Rest APIs to Get and Export Workflows from Nintex documentation. Can someone please help me with API to delete Nintex Workflows to use in Poweshell ?

icon

Best answer by Vdhakol 3 July 2023, 15:43

View original

7 replies

Userlevel 6
Badge +22

Hi @Vdhakol 

 

Does this help?
https://help.nintex.com/en-US/sdks/sdk2013/#Reference/SOAP/NW_REF_SOAP_DeleteWorkflow.htm?TocPath=Nintex%2520Software%2520Development%2520Kit%257CNintex%2520Workflow%25202013%2520Software%2520Development%2520Kit%257CNintex%2520Workflow%25202013%2520SDK%2520Reference%257CWeb%2520Service%2520Reference%257CService%2520operations%257C_____10

Badge +1

Hi,

Thanks for the reply.

Could you please share CSOM PowerShell script to run that SOAP service with credentials ?

I’m not getting how we can execute that SOAP request.

 

Thanks in advance.

Userlevel 5
Badge +13

Hi @Vdhakol 

 

The Nintex SDK is a c# toolkit that can be installed on the SP server.

 

see here the steps to install.

 

https://help.nintex.com/en-US/sdks/sdk2013/#Installation/SDK_NW_INS_NAV.htm?TocPath=Nintex%2520Software%2520Development%2520Kit%257CNintex%2520Workflow%25202013%2520Software%2520Development%2520Kit%257CInstalling%2520and%2520Using%2520the%2520Nintex%2520Workflow%25202013%2520SDK%257C_____0

 

and example code you could use to delete workflows is below, please keep in mind this is an old script but it should work.

 

using Nintex.Workflow;

// Connect to the Nintex platform
var client = new NintexClient();
client.Credentials = new System.Net.NetworkCredential("username", "password");

// Retrieve a list of workflows
var workflows = client.GetWorkflows();

// Construct the SOAP request
var request = new DeleteWorkflowsRequest();
request.WorkflowIds = workflows.Select(w => w.Id).ToList();

// Send the SOAP request
var response = client.DeleteWorkflows(request);

// Handle the response
if (response.Success)
{
Console.WriteLine("Workflows deleted successfully.");
}
else
{
Console.WriteLine("An error occurred while deleting workflows.");
}

 

Any other methods, using powershell or manually deleting may leave remnants in the dbs.

 

Jake

Userlevel 5
Badge +13

hi @Vdhakol 

 

Having looked around the old scripts I do have this script that targets the workflow template Nintex uses to delete them, However I cannot guarantee this will be thorough or accurate, it makes use a PnP and is written for 2016.

 

# Install PnP PowerShell module
Install-Module -Name "PnP.PowerShell" -Force

# Connect to SharePoint site
Connect-PnPOnline -Url "https://your-sharepoint-site-url" -UseWebLogin

# Load SharePoint Server Object Model assembly
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll"

# Get the current web
$web = Get-PnPWeb

# Get the Nintex workflows on the web
$nintexWorkflows = $web.WorkflowAssociations | Where-Object { $_.BaseTemplate -eq "NintexWorkflow2013" }

# Remove each Nintex workflow
foreach ($workflow in $nintexWorkflows) {
$web.WorkflowAssociations.Remove($workflow)
}

# Update the web to persist the changes
$web.Update()

 

Jake

Userlevel 5
Badge +20

Hi @Vdhakol 
Have you managed to resolve this?  

Badge +1

I got a response from Nintex team saying “There is no API method or end points available to remove/delete Nintex workflows from SharePoint online sites. So, there is no supported way to delete workflows in bulk through command line and you need to manually delete the workflows from the sites.”

Userlevel 6
Badge +22

Hi @Vdhakol 

I am sorry that we gave you the incorrect information but this post was in the Nintex for SharePoint forum and not in the Nintex for Office 365 forum and was not tagged with Office 365.
I have now moved the post to the correct forum.

Reply