Run a Powershell Script using Studio Workflow

Overview

You can use Studio's Workflow Tasks to run a Powershell script. For the purposes of this example we will use the DeleteFiles Powershell script.

Create a Program Workflow Task 

Name

Enter a unique name for your task. It is advisable to call this something relevant as this name will be used to populate list box selections when creating Jobs.

Details

Program

Use the browse button to select the powershell.exe program from the Windows folder e.g. c:\windows\syswow64\windowspowershell\v1.0\powershell.exe

Additional Parameters

Here you need to enter the following details:

Additional Parameters
-ExecutionPolicy Bypass <path to powershell script> <any parameters required by the script>

For example in the case of the DeleteFiles script : 

Example
 -ExecutionPolicy Bypass d:\astun\Tools\Powershell\DeleteFiles.ps1 -path d:\astun\isharemap\webservice\sld\ -filespec *.xml -age 1 -commit $true