Skip to main content
Nintex Community Menu Bar

Powershell Script to get the mappings between SharePoint content db and Nintex workflow

  • August 2, 2019
  • 1 reply
  • 172 views

Forum|alt.badge.img

Hello Everyone,

 

I want a Powershell script to get the list of mappings between SharePoint content DB and Nintex workflow DB.

 

Regards,

Ravi

1 reply

Simon Muntz
Nintex Partner
Forum|alt.badge.img+23
  • Nintex Partner
  • August 3, 2019

Hi

Input your Nintex configuration database connection string and the name of your SharePoint database and run.

$Datatable = New-Object System.Data.DataTable 

    $Connection = New-Object System.Data.SQLClient.SQLConnection 

    $Connection.ConnectionString = "Data Source=DatabaseServer;Initial Catalog=NintexConfigDatabase;Integrated Security=True" # REPLACE CONNECTION STRING 

    $Connection.Open() 

    $Command = New-Object System.Data.SQLClient.SQLCommand 

    $Command.Connection = $Connection 

    $Command.CommandText = "Select Distinct D.DatabaseName,O.Name
From dbo.ContentDbMapping CM
INNER JOIN dbo.Databases D
ON CM.NWContentDbId = D.DatabaseID
INNER JOIN [SharePoint_Config].[dbo].[SiteMap] SP
ON  CM.SPContentDbId = SP.DatabaseId
INNER JOIN [SharePoint_Config].[dbo].[Objects] O 
ON O.Id=SP.DatabaseId" #REPLACE SharePoint_Config with your sharepoint database name

    $Reader = $Command.ExecuteReader() 

    $Datatable.Load($Reader) 

    $Connection.Close() 

return $Datatable