Activities

Interactive PSscript

This activity runs a powershell script under interactive session.

Prequisites

Server Settings

Local Security Policy

User whose active session ID will be used ,must be added to the following security privileges. In order to do this, log in to the remote server with a user with elevated privileges and go to Control Panel-> Administrative Tools -> Local Security Policy. When Local Security Policy opens, go to Local policies -> User Rights Assignment and add the desired user to the following:

Local Users and Groups

User whose active session ID will be used, must be added to the local administrators group.

Activity Parameters

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

Interactive Agent:

Parameters:


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


PS Script

This activity runs a powershell script.

Activity Parameters

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

Parameters:


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:

Parameters Remoting:

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

 



Powershell Demo sequence:


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



Get-Service command situation

The Get-Service commands requires the activity to use Runspaces or Jobs in order to properly execute, without throwing exceptions.

The most common error message is that there is no available Runspace to execute the current thread.

For preventing this situation, the command will be used as a Job, using ScriptBlock.

The PSScript code will look like:

Information regarding the retrieved services can be extracted from the PSScript's output and converted to ServiceController and ServiceControllerStatus objects:


The variables should be declared with the following types:





Powershell DSC

This activity rsends the compiled configuration files(.mof) to the MS Configuration Service for execution

Activity Parameters

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

Parameters:

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

 
Note: The destination server must have powershell version 4 or later and the mod file must be named after the ComputerName

Powershell Script External

This activity runs an external powershell script (allowing the user to pass on parameters directly via the activity and not by using arguments list). 

Activity Parameters

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


Parameters:

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


Execution: