Another issue is that on the NintexWorkflowHistory list that is created on a site by Nintex there is an eventReciever which has a class Nintex.Workflow.Features.WorkflowHistoryEventReciever
The History Lists I create do not have this event receiver at the time of creation. When I revisit these lists the event receiver is added so perhaps there is another mechanism that insures these are added? Like when a workflow is associated with the History List or when earlier when it is enabled? At any rate It appears there is something else happening under the hood when we created these through the Nintex GUI.
Incidentally, I am able to attach the event Receiver to the lists like this:
| $type = "ItemAdded" |
| $assembly = "Nintex.Workflow.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=913f6bae0ca5ae12" |
| $class = "Nintex.Workflow.Features.WorkflowHistoryEventReciever" |
| $list.EventReceivers.Add($type, $assembly, $class) |
However, if there is a template I can use (I don't think there is) or another means to duplicate the creation of these lists in powershell that would be ideal.
I am also looking to do the same. We have 20 different WF history lists that I would like to create on 10 different farms, but I guess I have to use the GUI....
You can create these in PowerShell. I have only a few to do but you could do this in a loop as well:
$SPTemplate = $spweb.ListTemplatesn"Workflow History"]
$spweb.Lists.Add("LISTNAME1","LIST DESCRIPTION",$SPTemplate)
Start-Sleep -s 5;
$SPTemplate = $spweb.ListTemplatesn"Workflow History"]
$spweb.Lists.Add("LISTNAME2","LIST DESCRIPTION",$SPTemplate)
Start-Sleep -s 5;
$SPTemplate = $spweb.ListTemplatess"Workflow History"]
$spweb.Lists.Add("LISTNAME3","LIST DESCRIPTION",$SPTemplate)
Start-Sleep -s 5;
Write-Host "WF History Lists added"