SharePoint 2016 Logo

I used Advanced Workflow Actions for SharePoint Designer 2010 from iLoveSharePoint for Workflows in SharePoint site. And one of used by me activities was "Execute PowerShell Script Action".

My PowerShell workflow used to copy attachment from a list to list item according selected values. I wrote PowerShell script and tested it. But when I attached it as workflow (entered private key and set up workflow according to documentation), I always got the error after executing. The error was:

Error while executing PowerShell Script: Cannot invoke this function because the current host does not implement it.

I got a lot of versions of this error and tried to debug. But nothing could help me.

Then I remember one bug in Internet Explorer – when you use "console.log" command in your javascript code, Internet Explorer simply ignores these files.

The solution for workflow was about the same. As soon as I removed all the lines with "Write-host", workflow started to work without errors.