PowerShell Script Custom Workflow Action

Discussion created by on Jan 7, 2015
Latest reply on Oct 6, 2015 by

Hi All,

I put together a custom Nintex Workflow action that executes PowerShell script based on Christian Glessners’ Execute PowerShell Script Action which is part of his Advanced Workflow Actions for SharePoint Designer 2010 which you can find on CodePlex.


The following variables are provided to your script:

  • $site = the current Microft.SharePoint.SPSite
  • $web = the current Microft.SharePoint.SPWeb
  • $list = the current Microft.SharePoint.SPList (null in site workflows)
  • $item= the current Microft.SharePoint.SPListItem (null in site
  • $ctx = the current workflow context
  • $sharePointService = the current
    Microsoft.SharePoint.Workflow.ISharePointService service
  • $listItemService = the curent Microsoft.SharePoint.Workflow.IListItemService


There are also 5 user variables that can be used as both input and output to your script.  One of the great things about this action is that you can require that all scripts have to be signed, thus preventing your workflow designers from writing any PowerShell they want. This is a farm level setting which means you can have it turned off in DEV but require it in TEST & PROD.


You can also pass in an encrypted string which will be decrypted at runtime which can be used for passwords.  Lastly, you can pass in a Secure Store AppId which will retrieve the credentials from the Secure Store Service at runtime and pass it in as the variable $credential as a
System.Net.NetworkCredentials object.