This project is read-only.


Aug 29, 2008 at 2:40 PM
First, I want to thnak you for creating this activity, I have used your powershell workflow desgner activity successfully  when referencing a .ps1 file from my c: drive.

What I'm attempting to do now is maintain a splist of scripts that I can pull into the workflow, assign to $variable1 and run through your powershell activity with the invoke-expression cmdlet.

For example :
sharepoint list -> added column 'ScriptSource' and populated with "$web.title = 'test'; $web.update();"
I attached SPD work flow to a document library that uses Powershell activity and load $variable1 with the above list field value.

I'm receiving the following error in the hive log:

 WinWF Internal Error, terminating workflow Id# 588be532-3a1e-4474-988d-d159e7ca9cff 
08/29/2008 09:10:00.78  w3wp.exe (0x0614)                        0x0F58 Windows SharePoint Services    Workflow Infrastructure        98d4 Unexpected System.Management.Automation.CmdletInvocationException: An expression was expected after '('. ---> System.Management.Automation.ParseException: An expression was expected after '('.     at System.Management.Automation.Parser.valueRule(Tokenizer tok)     at System.Management.Automation.Parser.propertyOrArrayReferenceRule(Tokenizer tok, Boolean parameterMode)     at System.Management.Automation.Parser.pipelineRule(Tokenizer tok)     at System.Management.Automation.Parser.statementRule(Tokenizer tok)     at System.Management.Automation.Parser.statementListRule(Tokenizer tok)     at System.Management.Automation.Parser.cmdletBodyRule(Tokenizer tok, Token fnName, Boolean isFilter, ParameterDeclarationNode parameters, Boolean scriptMode)     at System.Management.Automation.Parser.ParseScriptBlock... 
08/29/2008 09:10:00.78* w3wp.exe (0x0614)                        0x0F58 Windows SharePoint Services    Workflow Infrastructure        98d4 Unexpected ...(String input)     at System.Management.Automation.AutomationEngine.ParseScriptBlock(String script)     at System.Management.Automation.ScriptBlock..ctor(ExecutionContext context, String script)     at System.Management.Automation.CommandInvocationIntrinsics.NewScriptBlock(String scriptText)     at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord()     at System.Management.Automation.Cmdlet.DoProcessRecord()     at System.Management.Automation.CommandProcessor.ProcessRecord()     --- End of inner exception stack trace ---     at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)     at System.Management.Automation.Parser.PipelineNode.Execute(Array input, Pipe outputPipe, ArrayList& ... 
08/29/2008 09:10:00.78* w3wp.exe (0x0614)                        0x0F58 Windows SharePoint Services    Workflow Infrastructure        98d4 Unexpected ...resultList)     at System.Management.Automation.Parser.StatementListNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList) 
08/29/2008 09:10:01.04  w3wp.exe (0x0614)                        0x00A8 Windows SharePoint Services    General                        0 Unexpected ERROR: request not found in the TrackedRequests. We might be creating and closing webs on different threads. ThreadId = 1, Free call stack =    at Microsoft.SharePoint.SPRequestManager.Release(SPRequest request)     at Microsoft.SharePoint.SPSite.Close()     at Microsoft.SharePoint.SPSite.Dispose()     at Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver.AutoStartWorkflow(SPItemEventProperties properties, Boolean bCreate, Boolean bChange, AssocType atyp)     at Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver.AutoStartWorkflow(SPItemEventProperties properties, Boolean bCreate, Boolean bChange)     at Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver.ItemUpdated(SPItemEventProperties properties)     at Microsoft.SharePoint.SPEventManager.RunItemEventR... 
08/29/2008 09:10:01.04* w3wp.exe (0x0614)                        0x00A8 Windows SharePoint Services    General                        0 Unexpected ...eceiver(SPItemEventReceiver receiver, SPItemEventProperties properties, SPEventContext context, String receiverData)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, Object properties, SPEventContext context, String receiverData)     at Microsoft.SharePoint.SPEventManager.<>c__DisplayClass8`1.<InvokeEventReceivers>b__0()     at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, CodeToRunElevated code)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPUserToken userToken, RunEventReceiver runEventReceiver, O... 
08/29/2008 09:10:01.04* w3wp.exe (0x0614)                        0x00A8 Windows SharePoint Services    General                        0 Unexpected ...bject receivers, Object properties, Boolean checkCancel)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](Byte[] userTokenBytes, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel)     at Microsoft.SharePoint.SPEventManager.HandleEventCallback[ReceiverType,PropertiesType](Object callbackData)     at Microsoft.SharePoint.Utilities.SPThreadPool.WaitCallbackWrapper(Object state)     at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)     at System.Threading.ExecutionContext.runTryCode(Object userData)     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)     at System.Threading.ExecutionContext.RunInternal(Exe... 
08/29/2008 09:10:01.04* w3wp.exe (0x0614)                        0x00A8 Windows SharePoint Services    General                        0 Unexpected ...cutionContext executionContext, ContextCallback callback, Object state)     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)  , Allocation call stack (if present) null 

Any ideas? or is this even possible?
Thanks again for the great activity!
Joe Amen
Aug 29, 2008 at 7:11 PM
Hey Joe,

that's possible.
1) Define a workflow variable type of string in SPD
2) Use the Set Variable Action to get the script out of your script list (lookup) into the workflow variable.
3) Set the Execute-PowerShell's script variable to the workflow variable.
That's it. Hope this helps.

SharePoint Designer Workflows are cumbersome.I would recommend you Nintex Workflow 2007.
I'm just writting a PowerActivity for Nintex with an richer gui and perhaps integrate a list to manage scripts in a doclib...

Aug 29, 2008 at 8:02 PM
So glad to hear back so soon! I'll have to check out the Ninetex workflow 2007, hopefully sometime this weekend.

I have followed your instructions and have entered the following script into my splist scriptsource field :
$item.title = 'test';$item.update();

Upon execution of my workflow, the first part of the error from the hive log is :
System.Management.Automation.CmdletInvocationException: An expression was expected after '('.

Makes me wonder if my stringified script is being parsed by some other process...or maybe I need to escape my parens... very simple string scripts do run using this method,  I'm just not sure how I need to format my string in my splist item.

I'm convinced this will work so I'm not going to give up... Thanks again and have a great Memorial day weekend!

Aug 29, 2008 at 8:33 PM

your welcome. I've uploaded you 2 screenshots how I've configured that scenario:

Aug 29, 2008 at 9:36 PM

Success!! I've also realized that I don't even have to set a variable with the script from my splist.. I just point the script at the splist item and it executes, no need for invoke-expression. Again, thanks for your quick response, and have a great weekend!

Aug 30, 2008 at 12:11 PM
Hi Joe,

wish you a great weekend too. What't your doing with the "Most Powerful Activity On Earth" ;-) - Business scenario?


Aug 30, 2008 at 2:59 PM
Christian, we are using your power shell workflow activity to access the and move docs into zip files. Powershell scripts make it most easy to accomplish this. We are storing our scripts in a splist for ease of maintenance and portabilty. I've only just started working with powershell this last week and find it very powerful and great potenial. Your PS workflow activity makes it so easy to integrate with sharepoint. Good work my friend and thanks! Joe

-----Original Message-----
From: "cglessner" <[email removed]>
To: "[email removed]" <[email removed]>
Sent: 8/30/2008 7:11 AM
Subject: Re: INVOKE-EXPRESSION [iLoveSharePoint:34536]

From: cglessner

Hi Joe,

wish you a great weekend too. What't your doing with the "Most Powerful Activity On Earth" ;-) - Business scenario?


Aug 31, 2008 at 6:48 PM
Hi Joe,

I've just released PowerActivity V1.0.
The main enhancement is a better script designer. Now you can do lookups direct in the script designer.
Furthermore the deployment is a bit better, but you still have to modify the web.config.

The new activity will not crash the old one. Means you can use them in parallel. But in the future I'll only support the new one.
If you will have any issues please report them in the issuer tracker.
Any ideas you can just post here.

Bye the way, if you like the activity I would be happy if you rate for it.

What dou you think about Nintex?

Hope you have fun with the PowerActivity.