Share via


PowerShellOnTargetMachines@2 - PowerShell on Target Machines v2 task

Use this task to execute PowerShell scripts on remote machine(s).

Inputs

EnvironmentName - Machines
string. Required.

Specifies a comma-separated list of machine IP addresses or FQDNs, along with ports. The default port is based on the selected protocol.
For example: dbserver.fabrikam.com,dbserver_int.fabrikam.com:5986,192.168.12.34:5986
You can also provide the output variable of other tasks, for example $(variableName). If you're using HTTPS, the name or IP of the machine should match the CN in the certificate.


AdminUserName - Admin Login
string.

Specifies the administrator login for the target machines.
For example: Domain\Admin User, Admin User@Domain, .\Admin User.


AdminPassword - Password
string.

Specifies the administrator password for the target machines. Variables defined in build/release definitions as $(passwordVariable) are accepted. You may mark the variable type as secret to secure it.


Protocol - Protocol
string. Allowed values: Http, Https.

Specifies the protocol to use for the WinRM service connection with the machine(s). The default value is HTTPS.


TestCertificate - Test Certificate
boolean. Optional. Use when Protocol = Https. Default value: true.

Specifies the option to skip validating the authenticity of the machine's certificate by a trusted certification authority. The parameter is required for the WinRM HTTPS protocol.


ScriptPath - PowerShell Script
string. Required.

Specifies the location of the PowerShell script on the target machines or on a UNC path, like C:\BudgetIT\Web\Deploy\Website.ps1.


ScriptArguments - Script Arguments
string.

Specifies the arguments for the PowerShell script. Can be ordinal or named parameters, like -testParam test.


InitializationScriptPath - Initialization Script
string.

Specifies the location of the data script for DSC on the target machines or on a UNC path, like C:\BudgetIT\Web\Deploy\WebsiteConfiguration.ps1.


SessionVariables - Session Variables
string.

Specifies the common session variables for both scripts. For example, $variable = value or $var1 = "value, 123".


RunPowershellInParallel - Run PowerShell in Parallel
boolean. Default value: true.

If set to true, runs the PowerShell scripts in parallel on the target machines.


ResourceFilteringMethod - Select Machines By
string. Allowed values: machineNames (Machine Names), tags. Default value: machineNames.

Optional. Specifies a subset of machines by providing machine names or tags.


MachineNames - Filter Criteria
string.

This input is valid only for machine groups or output variables. It is not supported for a flat list of machines yet.

Specifies a list of machines, like dbserver.fabrikam.com, webserver.fabrikam.com, 192.168.12.34 or tags, like Role:DB; OS:Win8.1. If multiple tags are specified, the task will run in all machines with the specified tags. The default runs the task in all machines.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

What's new in Version 2.0:

  • Removed support of legacy DTL machines.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.104.0 or greater
Task category Deploy