Powershell Task

EDIS Online User Guide – Powershell Task

The powershell task allows you to run a powershell script directly from T-SQL. Below are a couple examples:

Procedure: SSISDB.EDIS.usp_run_powershell_script


Name Description Default Value
@script Powershell script to run None; Required
@output_tbl_nm Global temporary table to output powershell results to. This is optional and useful for capturing outputs such as echo messages and piped results Empty String



Example 1: Get files in a folder

EXEC SSISDB.EDIS.usp_run_powershell_script

 @script = 'get-childitem -Path "C:\temp\"'

,@output_tbl_nm = '##files'

SELECT * FROM ##files


Example 2: Copy a directory

DECLARE @usr_script nvarchar(max) =


Copy-Item c:\data_bin\* c:\data_bin_archive

echo "copy complete"


EXEC SSISDB.EDIS.usp_run_powershell_script @script = @usr_script;