In order to provide a more consistent experience with the System Center product family, we've moved the Orchestrator blog to another blog at http://blogs.technet.com/b/orchestrator. Be sure to go there for all the latest info!
Note: The workflow sample mentioned in this article can be downloaded from the Opalis project on CodePlex: http://opalis.codeplex.com
Examples that demonstrate the use of the Run .Net Script Activity which enables the integration of .NET scripting and code to be integrated into Workflows
These examples require the .NET Framework and PowerShell.
This Workflow uses PowerShell to count the number of files in a given folder. The Custom Start Activity is used to obtain a folder name using a parameter:
The Run .Net Script Activity 'Count Files in Folder' runs a PowerShell script that subscribes to the Published Data 'Folder' from the Custom Start Activity:
The value of variable '$numFiles' is made available as Published Data 'Number of Files' on the Opalis Databus:
The Send Platform Activity subscribes to the Published Data 'Number of Files' from the Run .Net Script Activity to display the resulting output:
Launch the Workflow '1. PowerShell: Count Files' by starting it from the Operator Console or by running it using the Testing Console. When prompted, enter a valid folder name (without trailing '\'):
Check the Operator Console Event screen or the Workflow Testing Console log to see the resulting output.
This Workflow uses the Run .Net Script Activity 'Calculate UNIX Time' to run two lines of C# code that calculate a UNIX Time Stamp (based on seconds since the standard epoch of 1/1/1970):
The appropriate .NET Namespaces and Assembly are referenced in the 'Advanced' tab:
The value of variable 'output' is made available as Published Data 'Unix Time' on the Opalis Databus:
The Send Platform Activity subscribes to the Published Data 'Unix Time' from the Run .Net Script Activity to display the resulting output:
Launch the Workflow by using Start, or by running it using the Workflow Testing Console. Check the Opalis Designer Events tab or the Testing Console log to see the resulting output.
Refer to the Run .NET Script Online Help for more information.