SharePoint Workflow Doesn't Kick Off When ListItem is Updated by Script RRS feed

  • Question

  • I use a PowerShell script which is kicked off on a schedule from the Windows task scheduler.  The scheduled task runs under the farm service account credentials.  This script queries a SharePoint list and does some processing.  Once the script has finished processing, it sets the status on the SharePoint list item to indicate that it has completed successfully. There is a SharePoint workflow on the list that should kick off once the list item has been updated by the script.  This workflow should send an email out to people who need to know that the process has completed and make a log entry so that there is history in the list item stating that the email went out. When I check the data in the list item, I can see that the script did in fact update the data, but unfortunately, the workflow never kicks off upon the status update by the PowerShell script.  When I manually launch the workflow, the emails go out and the log entry is made (as expected).

    I find an article on a technet blog that I understand to be saying that a system account should not be used to update a list item if the update should be expected to trigger a workflow.

    When I found this article I went back and changed the credentials in the scheduled task to use a different domain account.  I ensured that the new account had full control on the list.  The script kicked off, but didn’t successfully query the list, so I made the new account a site collection administrator, but this didn’t help.  I’m still getting the following error:

    “The local farm is not accessible.  Cmdlets with FeatureDependencyID are not registered.”

    I need to be able to query a list (and update it) using a PowerShell script.  I need the SharePoint workflow to kick off when the list item is updated by the script.  How can I successfully accomplish this?

    Freddy Thomas

    Wednesday, January 8, 2014 4:02 PM


All replies

  • Thank you, Luis.  I appreciate your feedback. 

    I believe I forgot to mention that I'm using SharePoint 2010.  (I'm not sure if this is a factor here or not.)
    Also, I'm running this PowerShell script on a Windows 2008 R2 server (my SharePoint 2010 server) so I don't have the most recent version of Powershell.

    I've tried to use the code on the link you supplied to write this capability into my PowerShell script and I've not been successful.  It's likely due to my abilities (or rather the lack thereof).

    I was wondering if you know of any online examples for how to launch a SharePoint 2010 workflow using PowerShell?  

    Freddy Thomas

    Thursday, January 16, 2014 6:29 PM
  • Hi Fredy Thomas,

    I would suggest you first to resolve the error “the local farm is not accessible…”, this error is because that the user that runs the SharePoint PowerShell commands needs to have the right “SharePoint_Shell_Access” to the SharePoint_Configuration database. You can set the permission using PowerShell command:
    Add-SPShellAdmin –UserName domain\user

    Or open the SQL Server Database, set the permission as following sample:


    SharePoint 2013 workflow is different from 2010 workflow, to start a 2010 workflow using PowerShell, using the code sample in below article:


    Qiao Wei
    TechNet Community Support

    • Marked as answer by Qiao Wei Tuesday, February 11, 2014 3:44 AM
    Tuesday, January 21, 2014 2:27 AM