AWS Tools for Microsoft Visual Studio Team Services
User Guide

AWS Tools for Windows PowerShell Script Task


Runs a PowerShell script that uses cmdlets from the AWS Tools for Windows PowerShell module. The module is automatically installed if it isn't already available in the environment.


This task accepts a PowerShell command or script that uses cmdlets from the Tools for Windows PowerShell module to interact with AWS services. You can specify the script to run via its file name, or you can enter it into the task configuration. Before running the supplied script, the task tests to see if the required Tools for Windows PowerShell module is already installed. If it isn't installed, the latest available version from the PowerShell Gallery is downloaded and installed.


If an installation is performed, the module is installed in the current user scope. The location is compatible with automatic module load. As a result, you don't need to import the module in your script.


You can set the following parameters for the task. Required parameters are noted by an asterisk (*). Other parameters are optional.


The default name of the task, AWS Tools for Windows PowerShell Script.

AWS Credentials*

The AWS credentials used by the cmdlets in the module. If needed, choose +, and then add a new AWS connection.

AWS Region*

The default AWS Region that the cmdlets assume in the module. AWS cmdlets invoked without a -Region parameter automatically use this value. For more information, see Regions and Endpoints in the Amazon Web Services General Reference.


Optional arguments to pass to the script. You can use ordinal or named parameters.

Script Source*

The type of script to run. Choose Script File to run a script that is contained in a file. Choose Inline Script to enter the script to run in the task configuration.

Script Path*

Required if the Script Source parameter is set to Script File. Specify the full path to the script you want to run.

Inline Script*

Required if the Script Source parameter is set to Inline Script. Enter the text of the script to run.


Prepends the line $ErrorActionPreference = 'VALUE' at the top of your script.


Fail on Standard Error

If this option is selected, the task will fail if any errors are written to the error pipeline, or if any data is written to the Standard Error stream. Otherwise, the task relies on the exit code to determine failure.


If this option is not selected, the line if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE } is appended to the end of your script. This causes the last exit code from an external command to propagate as the exit code of PowerShell. Otherwise, the line is not appended to the end of your script.

Working Directory

The working directory where the script runs.