Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The PS Script activity parameters can be provided by manual inserted values or via IN arguments or variables:

Image RemovedImage Added

Parameters:

  • Input Object Script Code (text box editor type) (type: string): the input object that will be shown or bind this parameter with an Output parameter of a desired activity the Powershell script code to be executed. For example: "mkdir 'C:\FlowsterSolutions'" (this command creates a folder with the specified path).
  • Script File (text box editor type) (type: string): the Powershell script file. This parameter takes precedence over the "Script Code" parameter.

As mentioned above, the values for all the required parameters can be provided by IN arguments or variables. Below is an example of predefined arguments, ready to be used by the PS Script activity:

Image RemovedImage Added

The Read Only Output variable are the possible output values that the activity will provide:

  • DateTime Object Output (type: string): outputs the input object as a string.

...

Image Removed

 

 

 

Parameters

...

NameDescriptionType
scriptCodeEnter the Powershell script code that you want to be executed. For example: mkdir "C:\\FoundMediaSoftware " (this command creates a folder with the specified path)System.String
FilePathEnter a Powershell script file. This parameter takes precedence over the 'Script code' parameter.System.String

Read-Only Output

...

  • collection<PSObjects>): outputs a collection of "PSObjects" type objects..
  • Output Rows (type: int32): outputs the number of "PSObjects" type objects returned by the execution of the script

...

  • .

...

 

...

Image Added

Image Removed

 

...

Activities

PSscript

This activity allows the user runs a powershell script.

Activity Parameters

PSscript

Input Values

...

 

...

Output Values

The output values are stored in two defined variables. Given the case, OUT arguments may be used in the same manner. If the output values are not to be passed outside the task, variables need not be defined, but instead set the "Track Outputs" property for this activity to "Yes" and the output values will be displayed in the Tracking Data without storing them in variables/OUT arguments.

...

"Browse and Select a .Net Type" window opens. In the Search field, type "Collection" and hit "Enter". After the results are displayed, select the one of type collection<T>. Because the "Output" parameter is of type collection<PSObject>, and 'PSObject' type is not a generic one, select from the drop down list "Browse for Types.." option.  When the second "Browse and Select a .Net Type" window opens, type in the Search field, 'PSObject'. After the results are displayed, select the basic 'PSObject' option and hit "Enter". The second "Browse and Select a .Net Type" window should close. Hit "Enter" again to close the first "Browse and Select a .Net Type" window.

Image Removed

The "Browse and Select a .Net Type" window will close and the "Collection" defined variable will be of type Collection<Object>.

Image Removed

The "Count" variable should be of type "Int32" because the output parameter "Output Rows" parameter returns a value of type "Int32".

In order to display the values stored in the "Collection" variable, an iterator-type activity must be used to iterate through the elements of the collection and output the stored values. For showcase purposes, in this task, Custom ForEach activity is used to iterate through the elements of the collection and Write Line activity will be used to display the elements of the collection in the Tracking Data panel.

The "Count" variable value may be displayed in the Tracking Data panel using a Write Line activity or any other activity that displays values in the Tracking Data panel after it has been converted to string ('Count.ToString()').

 

Powershell Demo sequence:

Image Added

 

On Execution (Home->(Execution section) Start button) -  task "Powershell_Demo"  , Tracking Data panel should display:

In order to import "Powershell_Demo" task in Flowster Studio Administrator, use Powershell_Demo.zip attachment. ( For further information check Importing Tasks in Flowster Studio Administrator )