Applications

  • $ApplicationDescription ([appName]) - description of the current or specified application

    $ApplicationDescription

    description of the current or specified application

    Script usage:

    $ApplicationDescription([appName])

    Parameters:

    Name Description
    appName Application Name
  • $ApplicationExists (Name, [IncludeInactive]) - Returns true if the application with the specified name exists, optionally including inactive applications.

    $ApplicationExists

    Returns true if the application with the specified name exists, optionally including inactive applications.

    Script usage:

    $ApplicationExists(Name, [IncludeInactive])

    Parameters:

    Name Description
    Name The name of the application to look for.
    IncludeInactive When false, this function will return false if the specified application exists but is inactive; otherwise, it will return true for inactive applications as well. The default value is false.
  • $ApplicationGroupName - name of the current application group

    $ApplicationGroupName

    name of the current application group

    Script usage:

    $ApplicationGroupName
  • $ApplicationName - name of the current application

    $ApplicationName

    name of the current application

    Script usage:

    $ApplicationName
  • @ApplicationsInGroup (groupName) - list of applications which belong to the specified application group

    @ApplicationsInGroup

    list of applications which belong to the specified application group

    Script usage:

    @ApplicationsInGroup(groupName)

    Parameters:

    Name Description
    groupName Application Group Name
  • @ReleasesInApplication ([ApplicationName], [Status]) - Gets a list of release numbers in an application, optionally filtered by status.

    @ReleasesInApplication

    Gets a list of release numbers in an application, optionally filtered by status.

    Script usage:

    @ReleasesInApplication([ApplicationName], [Status])

    Parameters:

    Name Description
    ApplicationName Application Name
    Status active, deployed, cancelled, or any

Builds

  • $ArtifactPath (ArtifactName, [buildNum], [releaseNum], [appName]) - gets the path within the internal disk store for the specified artifact

    $ArtifactPath

    gets the path within the internal disk store for the specified artifact

    Script usage:

    $ArtifactPath(ArtifactName, [buildNum], [releaseNum], [appName])

    Parameters:

    Name Description
    ArtifactName artifactName
    buildNum Build Number
    releaseNum Release Number
    appName Application Name
  • @ArtifactsInBuild ([buildNum], [releaseNum], [appName]) - list of all the artifacts in the current or specified build

    @ArtifactsInBuild

    list of all the artifacts in the current or specified build

    Script usage:

    @ArtifactsInBuild([buildNum], [releaseNum], [appName])

    Parameters:

    Name Description
    buildNum Build Number
    releaseNum Release Number
    appName Application Name
  • $BuildNumber ([releaseNum], [furthestOrLatest], [appName]) - build number of the current or specified release

    $BuildNumber

    build number of the current or specified release

    Script usage:

    $BuildNumber([releaseNum], [furthestOrLatest], [appName])

    Parameters:

    Name Description
    releaseNum Release Number
    furthestOrLatest Must be "furthest" or "latest"; the default is "latest".
    appName Application Name
  • @BuildsInRelease ([ReleaseNumber], [ApplicationName], [Status], [PipelineStage]) - Gets a list of builds in a release, optionally filtered by status and pipeline stage.

    @BuildsInRelease

    Gets a list of builds in a release, optionally filtered by status and pipeline stage.

    Script usage:

    @BuildsInRelease([ReleaseNumber], [ApplicationName], [Status], [PipelineStage])

    Parameters:

    Name Description
    ReleaseNumber Release Number
    ApplicationName Application Name
    Status active, deployed, rejected, or any
    PipelineStage Pipeline Stage
  • BuildVariable (VariableName, [BuildNumber], [ReleaseNumber], [ApplicationName]) - Gets the value of a variable defined on a build.

    BuildVariable

    Gets the value of a variable defined on a build.

    Script usage:

    BuildVariable(VariableName, [BuildNumber], [ReleaseNumber], [ApplicationName])

    Parameters:

    Name Description
    VariableName Variable Name
    BuildNumber Build Number
    ReleaseNumber Release Number
    ApplicationName Application Name

Configuration Files

  • @ConfigurationFileInstances (configurationFileName, [appName]) - list configuration file instances defined for an application

    @ConfigurationFileInstances

    list configuration file instances defined for an application

    Script usage:

    @ConfigurationFileInstances(configurationFileName, [appName])

    Parameters:

    Name Description
    configurationFileName The name of the configuration file.
    appName The name of the application.
  • @ConfigurationFiles ([appName]) - list configuration files defined for an application

    @ConfigurationFiles

    list configuration files defined for an application

    Script usage:

    @ConfigurationFiles([appName])

    Parameters:

    Name Description
    appName The name of the application.
  • $ConfigurationFileText (instance, [fileName], [releaseNum]) - text contents of the specified configuration file instance

    $ConfigurationFileText

    text contents of the specified configuration file instance

    Script usage:

    $ConfigurationFileText(instance, [fileName], [releaseNum])

    Parameters:

    Name Description
    instance The instance name of the configuration file.
    fileName The name of the configuration file, or defaults to single configuration file for the contextual deployable.
    releaseNum A specific release number, or defaults to contextual release number.
  • $ConfigurationFileVersion ([fileName], [releaseNum]) - version number used for deployment of the specified configuration file

    $ConfigurationFileVersion

    version number used for deployment of the specified configuration file

    Script usage:

    $ConfigurationFileVersion([fileName], [releaseNum])

    Parameters:

    Name Description
    fileName The name of the configuration file, or defaults to single configuration file for the contextual deployable.
    releaseNum A specific release number, or defaults to contextual release number.

Containers

  • $ContainerDigest (repositoryName, [tag], [sourceName]) - Gets the digest of a Docker image. The digest is from the image associated with the current build.

    $ContainerDigest

    Gets the digest of a Docker image. The digest is from the image associated with the current build.

    Script usage:

    $ContainerDigest(repositoryName, [tag], [sourceName])

    Parameters:

    Name Description
    repositoryName Repository Name
    tag Tag
    sourceName Source Name
  • @ContainersInBuild ([containerSource]) - Gets a list of Docker images in the current build. Each returned element is a map: %(Name: SomeName, Tag: 1.2.3, Digest: sha1:3924abbeeea2162, ContainerSource: SourceName)

    @ContainersInBuild

    Gets a list of Docker images in the current build. Each returned element is a map: %(Name: SomeName, Tag: 1.2.3, Digest: sha1:3924abbeeea2162, ContainerSource: SourceName)

    Script usage:

    @ContainersInBuild([containerSource])

    Parameters:

    Name Description
    containerSource Optional name of the container source to filter by.
  • $ContainerTag (repositoryName, [sourceName]) - Gets the tag of the specified Docker image associated with the current build.

    $ContainerTag

    Gets the tag of the specified Docker image associated with the current build.

    Script usage:

    $ContainerTag(repositoryName, [sourceName])

    Parameters:

    Name Description
    repositoryName Repository Name
    sourceName Source Name

Credentials

  • $CredentialProperty (credential, property) - the decrypted plain text value of a specified credentials property

    $CredentialProperty

    the decrypted plain text value of a specified credentials property

    Script usage:

    $CredentialProperty(credential, property)

    Parameters:

    Name Description
    credential The name of the credential to read, optionally prefixed with the type name of the credential separated by the scope resolution operator (i.e. ::).
    property The name of the credential property to get. If the property is encrypted, the credential itself must be configured to allow the value to be extracted, otherwise the function call will fail at run time.

    Example:

    # ProGetCreds is an instance of Inedo Product Credentials (i.e. InedoProduct::ProGetCreds) with 'Allow encrypted properties...' checked
    
    set $key = $CredentialProperty(ProGetCreds, ApiKey);
    set $host = $CredentialProperty(ProGetCreds, Host);
    
    Log-Debug Getting ProGet package from $host with API key: $key;
    
    ProGet::Get-Package(
    	Credentials: ProGetCreds,
    	Feed: hdars-1k,
    	Name: hdars,
    	Directory: $WorkingDirectory
    );
    

Databases

  • @DatabaseConnectionsInEnvironment ([environmentName]) - list of database connections for the current application which belong to the specified environment

    @DatabaseConnectionsInEnvironment

    list of database connections for the current application which belong to the specified environment

    Script usage:

    @DatabaseConnectionsInEnvironment([environmentName])

    Parameters:

    Name Description
    environmentName Environment Name

Deployables

  • @DependentApplications ([appName]) - list of applications which import at least one deployable from the specified application

    @DependentApplications

    list of applications which import at least one deployable from the specified application

    Script usage:

    @DependentApplications([appName])

    Parameters:

    Name Description
    appName The name of the application to return dependents for. If not specified, the application in the current context is used.
  • @DependentReleases (appName) - list of active or deployed releases from the specified application with at least one deployable imported from the current release of the current application

    @DependentReleases

    list of active or deployed releases from the specified application with at least one deployable imported from the current release of the current application

    Script usage:

    @DependentReleases(appName)

    Parameters:

    Name Description
    appName The name of the application that references the current application.
  • $DeployableName ([depName], [releaseNum]) - name of the current deployable in context

    $DeployableName

    name of the current deployable in context

    Script usage:

    $DeployableName([depName], [releaseNum])

    Parameters:

    Name Description
    depName The application-qualified name of the deployable (e.g. AppName::DeployableName); when no application name is specified, the current application in context will be used.
    releaseNum Release Number
  • @DeployablesInRelease ([appName], [releaseNum], [includeImported]) - list of deployables included in the specified release, or the current release in context

    @DeployablesInRelease

    list of deployables included in the specified release, or the current release in context

    Script usage:

    @DeployablesInRelease([appName], [releaseNum], [includeImported])

    Parameters:

    Name Description
    appName The name or ID of the application, or the current application in context if not specified.
    releaseNum The release number, or the current release number in context if not specified.
    includeImported A boolean indicating whether imported deployables should be included.
  • $ReferencedApplicationName ([depName], [releaseNum]) - application name referenced by the current or specified deployable

    $ReferencedApplicationName

    application name referenced by the current or specified deployable

    Script usage:

    $ReferencedApplicationName([depName], [releaseNum])

    Parameters:

    Name Description
    depName The application-qualified name of the deployable (e.g. AppName::DeployableName); when no application name is specified, the current application in context will be used.
    releaseNum Release Number
  • $ReferencedPackageNumber ([depName], [releaseNum], [furthestOrLatest]) - build number referenced by the current or specified deployable

    $ReferencedPackageNumber

    build number referenced by the current or specified deployable

    Script usage:

    $ReferencedPackageNumber([depName], [releaseNum], [furthestOrLatest])

    Parameters:

    Name Description
    depName The application-qualified name of the deployable (e.g. AppName::DeployableName); when no application name is specified, the current application in context will be used.
    releaseNum Release Number
    furthestOrLatest Must be "furthest" or "latest"; the default is "latest".
  • $ReferencedReleaseName ([depName], [releaseNum]) - release name of the current deployable in context

    $ReferencedReleaseName

    release name of the current deployable in context

    Script usage:

    $ReferencedReleaseName([depName], [releaseNum])

    Parameters:

    Name Description
    depName The application-qualified name of the deployable (e.g. AppName::DeployableName); when no application name is specified, the current application in context will be used.
    releaseNum Release Number
  • $ReferencedReleaseNumber ([depName], [releaseNum]) - release number of the current deployable in context

    $ReferencedReleaseNumber

    release number of the current deployable in context

    Script usage:

    $ReferencedReleaseNumber([depName], [releaseNum])

    Parameters:

    Name Description
    depName The application-qualified name of the deployable (e.g. AppName::DeployableName); when no application name is specified, the current application in context will be used.
    releaseNum Release Number

Environments

  • $EnvironmentName - name of the environment in context

    $EnvironmentName

    name of the environment in context

    Script usage:

    $EnvironmentName

Executions

  • $ExecutionId - Returns the current execution ID.

    $ExecutionId

    Returns the current execution ID.

    Script usage:

    $ExecutionId
  • $ExecutionState - Returns the current state of the execution (normal, warning, or error).

    $ExecutionState

    Returns the current state of the execution (normal, warning, or error).

    Script usage:

    $ExecutionState
  • $ExecutionUser - user name that initiated the current execution

    $ExecutionUser

    user name that initiated the current execution

    Script usage:

    $ExecutionUser
  • GetVariableValue (VariableName, [VariableType]) - Returns the value of a variable if the specified variable name is available in the current context; otherwise returns null.

    GetVariableValue

    Returns the value of a variable if the specified variable name is available in the current context; otherwise returns null.

    Script usage:

    GetVariableValue(VariableName, [VariableType])

    Parameters:

    Name Description
    VariableName The name of the variable.
    VariableType Must be one of: any, scalar, vector, or map; when none is specified, "any" is used.
  • $IsReexecution - true if the current execution is a redeployment

    $IsReexecution

    true if the current execution is a redeployment

    Script usage:

    $IsReexecution
  • $IsRollback - true if a build from an earlier release is redeployed to a stage

    $IsRollback

    true if a build from an earlier release is redeployed to a stage

    Script usage:

    $IsRollback
  • $IsVariableDefined (VariableName, [VariableType]) - Returns true if the specified variable name is available in the current context; otherwise returns false.

    $IsVariableDefined

    Returns true if the specified variable name is available in the current context; otherwise returns false.

    Script usage:

    $IsVariableDefined(VariableName, [VariableType])

    Parameters:

    Name Description
    VariableName The name of the variable.
    VariableType Must be one of: any, scalar, vector, or map; when none is specified, "any" is used.
  • $WorkingDirectory - Returns the current working directory.

    $WorkingDirectory

    Returns the current working directory.

    Script usage:

    $WorkingDirectory

Files

  • $DirectoryExists (name) - Returns "true" if the specified directory exists on the current server.

    $DirectoryExists

    Returns "true" if the specified directory exists on the current server.

    Script usage:

    $DirectoryExists(name)

    Parameters:

    Name Description
    name The path of the directory.
  • $FileContents (name, [maxLength]) - Returns the contents of a file on the current server.

    $FileContents

    Returns the contents of a file on the current server.

    Script usage:

    $FileContents(name, [maxLength])

    Parameters:

    Name Description
    name The path of the file.
    maxLength The maximum length (in characters) of the file to read.
  • $FileExists (name) - Returns "true" if the specified file exists on the current server.

    $FileExists

    Returns "true" if the specified file exists on the current server.

    Script usage:

    $FileExists(name)

    Parameters:

    Name Description
    name The path of the file.
  • @FileMask (includes, [excludes]) - Returns a list of files matching the mask on the current server.

    @FileMask

    Returns a list of files matching the mask on the current server.

    Script usage:

    @FileMask(includes, [excludes])

    Parameters:

    Name Description
    includes Includes
    excludes Excludes
  • $PathCombine (Path1, Path2) - Returns a string containing all of the arguments combined into a complete path.

    $PathCombine

    Returns a string containing all of the arguments combined into a complete path.

    Script usage:

    $PathCombine(Path1, Path2, ...)

    Parameters:

    Name Description
    Path1 The first path element.
    Path2 The second path element.

General

  • $Date ([Format]) - Returns the current date and time of the local timezone in the specified .NET datetime format string, or ISO 8601 format (yyyy-MM-ddThh:mm:ss) if no format is specified.

    $Date

    Returns the current date and time of the local timezone in the specified .NET datetime format string, or ISO 8601 format (yyyy-MM-ddThh:mm:ss) if no format is specified.

    Script usage:

    $Date([Format])

    Parameters:

    Name Description
    Format An optional .NET datetime format string.

    See also:

    Example:

    # format strings taken from https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
    set $OtterScript = >>
    Now: $Date
    UTC Now: $DateUtc
    
    Custom: $Date(hh:mm:ss.f)
    RFC1123: $Date(r)
    Sortable: $Date(s)
    Short time: $Date(t)
    >>;
    
    set $Result = $Eval($OtterScript);
    
    Log-Information $Result;
    
  • $DateUtc ([Format]) - Returns the current UTC date and time in the specified .NET datetime format string, or ISO 8601 format (yyyy-MM-ddThh:mm:ss) if no format is specified.

    $DateUtc

    Returns the current UTC date and time in the specified .NET datetime format string, or ISO 8601 format (yyyy-MM-ddThh:mm:ss) if no format is specified.

    Script usage:

    $DateUtc([Format])

    Parameters:

    Name Description
    Format An optional .NET datetime format string.

    See also:

    Example:

    # format strings taken from https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
    set $OtterScript = >>
    Now: $Date
    UTC Now: $DateUtc
    
    Custom: $Date(hh:mm:ss.f)
    RFC1123: $Date(r)
    Sortable: $Date(s)
    Short time: $Date(t)
    >>;
    
    set $Result = $Eval($OtterScript);
    
    Log-Information $Result;
    
  • Eval (Text) - Performs variable substitution and function evaluation for arbitrary text.

    Eval

    Performs variable substitution and function evaluation for arbitrary text.

    Script usage:

    Eval(Text)

    Parameters:

    Name Description
    Text The text to process.

    Example:

    # format strings taken from https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
    set $OtterScript = >>
    Now: $Date
    UTC Now: $DateUtc
    
    Custom: $Date(hh:mm:ss.f)
    RFC1123: $Date(r)
    Sortable: $Date(s)
    Short time: $Date(t)
    >>;
    
    set $Result = $Eval($OtterScript);
    
    Log-Information $Result;
    
  • $JenkinsCsrfProtectionEnabled - The default value for CsrfProtectionEnabled on Jenkins operations. Defaults to true.

    $JenkinsCsrfProtectionEnabled

    The default value for CsrfProtectionEnabled on Jenkins operations. Defaults to true.

    Script usage:

    $JenkinsCsrfProtectionEnabled
  • @Range (Start, Count) - Returns a range of integers starting from a specified value.

    @Range

    Returns a range of integers starting from a specified value.

    Script usage:

    @Range(Start, Count)

    Parameters:

    Name Description
    Start The first integer of the sequence.
    Count The number of integers to return.
  • $SpecialWindowsPath (Name) - Returns the full path of a special directory on a Windows system.

    $SpecialWindowsPath

    Returns the full path of a special directory on a Windows system.

    Script usage:

    $SpecialWindowsPath(Name)

    Parameters:

    Name Description
    Name One of the values of the Environment.SpecialFolder enumeration.

Git

  • $DefaultGitExePath - The path to the git executable to use for git operations; if not specified, a built-in library is used

    $DefaultGitExePath

    The path to the git executable to use for git operations; if not specified, a built-in library is used

    Script usage:

    $DefaultGitExePath
  • $DefaultGitExePath - The path to the git executable to use for git operations; if not specified, a built-in library is used

    $DefaultGitExePath

    The path to the git executable to use for git operations; if not specified, a built-in library is used

    Script usage:

    $DefaultGitExePath
  • $DefaultGitExePath - The path to the git executable to use for git operations; if not specified, a built-in library is used

    $DefaultGitExePath

    The path to the git executable to use for git operations; if not specified, a built-in library is used

    Script usage:

    $DefaultGitExePath

Json

  • FromJson (json) - Converts JSON to an OtterScript value.

    FromJson

    Converts JSON to an OtterScript value.

    Script usage:

    FromJson(json)

    Parameters:

    Name Description
    json The JSON data to parse.

    Example:

    %FromJson(>>{"abc":[1,2,3],"def":true}>>)
  • $JSEncode (Text) - Encodes a string for use in a JavaScript string literal.

    $JSEncode

    Encodes a string for use in a JavaScript string literal.

    Script usage:

    $JSEncode(Text)

    Parameters:

    Name Description
    Text The text to encode.
  • $ToJson (data) - Converts an OtterScript value to JSON.

    $ToJson

    Converts an OtterScript value to JSON.

    Script usage:

    $ToJson(data)

    Parameters:

    Name Description
    data The data to encode as JSON.

    Example:

    $ToJson(%(abc: @(1, 2, 3), def: true))

Linux

  • $SHEval (ScriptText) - Returns the output of a shell script.

    $SHEval

    Returns the output of a shell script.

    Script usage:

    $SHEval(ScriptText)

    Parameters:

    Name Description
    ScriptText The shell script to execute. This should be an expression.

    Example:

    # set the $NextYear variable to the value of... next year
    set $ShellScript = >>
    date -d next-year +%Y
    >>;
    set $NextYear = $SHEval($ShellScript);
    Log-Information $NextYear;
    

Lists

  • @ListConcat - Creates a list containing the contents of each list in sequence.

    @ListConcat

    Creates a list containing the contents of each list in sequence.

    Script usage:

    @ListConcat
  • $ListCount (List) - Count the number of elements in a list.

    $ListCount

    Count the number of elements in a list.

    Script usage:

    $ListCount(List)

    Parameters:

    Name Description
    List The list.
  • $ListIndexOf (List, Item) - Finds the index of an item in a list. Finding the first item in a list returns 0, and finding an item not present in the list returns -1.

    $ListIndexOf

    Finds the index of an item in a list. Finding the first item in a list returns 0, and finding an item not present in the list returns -1.

    Script usage:

    $ListIndexOf(List, Item)

    Parameters:

    Name Description
    List The list.
    Item The item.
  • @ListInsert (List, Item, [Index]) - Inserts an item into a list.

    @ListInsert

    Inserts an item into a list.

    Script usage:

    @ListInsert(List, Item, [Index])

    Parameters:

    Name Description
    List The list.
    Item The item.
    Index The index. 0 inserts the item at the start of the list. If this parameter is not present, the item is added to the end of the list.
  • ListItem (List, Index) - Gets an item from a list.

    ListItem

    Gets an item from a list.

    Script usage:

    ListItem(List, Index)

    Parameters:

    Name Description
    List The list.
    Index The index of the item. The first item in a list is at index 0.
  • @ListRemove (List, Index) - Removes an item from a list.

    @ListRemove

    Removes an item from a list.

    Script usage:

    @ListRemove(List, Index)

    Parameters:

    Name Description
    List The list.
    Index The index of the item to remove. The first item in a list is at index 0.

Maps

  • MapAdd (Map, Key, Value) - Adds a key-value pair to a map.

    MapAdd

    Adds a key-value pair to a map.

    Script usage:

    MapAdd(Map, Key, Value)

    Parameters:

    Name Description
    Map The map.
    Key The key to add.
    Value The value to add.
  • MapItem (Map, Key) - Gets an item from a map.

    MapItem

    Gets an item from a map.

    Script usage:

    MapItem(Map, Key)

    Parameters:

    Name Description
    Map The map.
    Key The key.
  • @MapKeys (Map) - Lists the keys of a map.

    @MapKeys

    Lists the keys of a map.

    Script usage:

    @MapKeys(Map)

    Parameters:

    Name Description
    Map The map.
  • MapRemove (Map, Key) - Removes a key from a map.

    MapRemove

    Removes a key from a map.

    Script usage:

    MapRemove(Map, Key)

    Parameters:

    Name Description
    Map The map.
    Key The key to remove.

Math

  • $Compare (Arg1, Operator, Arg2, [AsNumber]) - Compare two values numerically or as case-sensitive strings.

    $Compare

    Compare two values numerically or as case-sensitive strings.

    Script usage:

    $Compare(Arg1, Operator, Arg2, [AsNumber])

    Parameters:

    Name Description
    Arg1 The left-hand side of the comparison.
    Operator One of: <, >, <=, >=, =, !=
    Arg2 The right-hand side of the comparison.
    AsNumber Override number detection. True causes an error if the arguments cannot be parsed as numbers. False always compares them as strings.
  • $Decrement (value, [amount]) - Returns a string that contains the result of decrementing a value.

    $Decrement

    Returns a string that contains the result of decrementing a value.

    Script usage:

    $Decrement(value, [amount])

    Parameters:

    Name Description
    value The value to decrement.
    amount The amount that will be subtracted from the value. If not specified, 1 is used.

    See also:

  • $Increment (value, [amount]) - Returns a string that contains the result of incrementing a value.

    $Increment

    Returns a string that contains the result of incrementing a value.

    Script usage:

    $Increment(value, [amount])

    Parameters:

    Name Description
    value The value to increment.
    amount The amount that will be added to the value. If not specified, 1 is used.

    See also:

Nuget

  • $NuGetExePath - The path to the nuget.exe client, otherwise the included nuget.exe client is used.

    $NuGetExePath

    The path to the nuget.exe client, otherwise the included nuget.exe client is used.

    Script usage:

    $NuGetExePath

Packages

  • $PackageHash (packageName, [sourceName]) - Gets the hex-encoded SHA1 hash of a package. The hash is from the version of the package associated with the current build.

    $PackageHash

    Gets the hex-encoded SHA1 hash of a package. The hash is from the version of the package associated with the current build.

    Script usage:

    $PackageHash(packageName, [sourceName])

    Parameters:

    Name Description
    packageName Package Name
    sourceName Source Name
  • $PackageProperty (packageName, packageProperty, [sourceName]) - Gets a value from the metadata of a package. The property is from the version of the package associated with the current build.

    $PackageProperty

    Gets a value from the metadata of a package. The property is from the version of the package associated with the current build.

    Script usage:

    $PackageProperty(packageName, packageProperty, [sourceName])

    Parameters:

    Name Description
    packageName Package Name
    packageProperty Package Property
    sourceName Source Name
  • @PackagesInBuild ([packageSource]) - Gets a list of packages in the current build. Each returned element is a map: %(Name: SomeName, Version: 1.2.3, PackageSource: SourceName)

    @PackagesInBuild

    Gets a list of packages in the current build. Each returned element is a map: %(Name: SomeName, Version: 1.2.3, PackageSource: SourceName)

    Script usage:

    @PackagesInBuild([packageSource])

    Parameters:

    Name Description
    packageSource Optional name of the package source to filter by.
  • $PackageVersion (packageName, [part], [sourceName]) - Gets the version of the specified package associated with the current build.

    $PackageVersion

    Gets the version of the specified package associated with the current build.

    Script usage:

    $PackageVersion(packageName, [part], [sourceName])

    Parameters:

    Name Description
    packageName Package Name
    part The version part, one of: 'full' (default), 'stable', 'pre-release', 'build'
    sourceName The package source name; defaults to searching all package sources.

Pipelines

  • $PipelineName - name of the pipeline in context

    $PipelineName

    name of the pipeline in context

    Script usage:

    $PipelineName
  • $PipelineStageName - name of the pipeline stage in context

    $PipelineStageName

    name of the pipeline stage in context

    Script usage:

    $PipelineStageName

PowerShell

  • $PSCredential (UserName, Password) - Returns a PSCredential object that can be passed to PowerShell scripts.

    $PSCredential

    Returns a PSCredential object that can be passed to PowerShell scripts.

    Script usage:

    $PSCredential(UserName, Password)

    Parameters:

    Name Description
    UserName The user name of the PSCredential object.
    Password The password of the PSCredential object.

    Example:

    # convert user and password to a PSCredential object
    PSCall MyPowerShellScript
    (
        Credentials: $PSCredential(user, password)
    );
    
  • PSEval (ScriptText) - Returns the result of a PowerShell script.

    PSEval

    Returns the result of a PowerShell script.

    Script usage:

    PSEval(ScriptText)

    Parameters:

    Name Description
    ScriptText The PowerShell script to execute. This should be an expression.

    Example:

    # set the $NextYear variable to the value of... next year
    set $PowershellScript = >>
    (Get-Date).year + 1
    >>;
    
    set $NextYear = $PSEval($PowershellScript);
    
    Log-Information $NextYear;
    

Releases

  • $CompareReleaseSequence (operator, releaseNum1, [releaseNum2]) - compares the release number of the current application with a specified release number

    $CompareReleaseSequence

    compares the release number of the current application with a specified release number

    Script usage:

    $CompareReleaseSequence(operator, releaseNum1, [releaseNum2])

    Parameters:

    Name Description
    operator Valid operators are: ==, !=, &gt;, &lt;, &gt;=, &lt;=
    releaseNum1 Release Number1
    releaseNum2 Defaults to the current release number in context when not specified.
  • $IncrementReleaseNumber (lastReleaseNumber, [releaseNumberScheme]) - Returns the next release number that would be assigned.

    $IncrementReleaseNumber

    Returns the next release number that would be assigned.

    Script usage:

    $IncrementReleaseNumber(lastReleaseNumber, [releaseNumberScheme])

    Parameters:

    Name Description
    lastReleaseNumber The release number to increment.
    releaseNumberScheme MajorMinor, MajorMinorRevision, or DateBased. If not specified, uses the release number scheme of the current application.
  • $PreviousReleaseNumber ([ReleaseNumber], [ApplicationName]) - release number of the last deployed release, relative to the specified or current release

    $PreviousReleaseNumber

    release number of the last deployed release, relative to the specified or current release

    Script usage:

    $PreviousReleaseNumber([ReleaseNumber], [ApplicationName])

    Parameters:

    Name Description
    ReleaseNumber Release Number
    ApplicationName Application Name
  • $ReleaseName ([ReleaseNumber], [ApplicationName]) - name of the current or specified release

    $ReleaseName

    name of the current or specified release

    Script usage:

    $ReleaseName([ReleaseNumber], [ApplicationName])

    Parameters:

    Name Description
    ReleaseNumber Release Number
    ApplicationName Application Name
  • $ReleaseNumber - release number of the current release

    $ReleaseNumber

    release number of the current release

    Script usage:

    $ReleaseNumber
  • $ReleaseNumberPart (Part, [ReleaseNumber]) - a part (major, minor, build, revision) of the current or specified release number

    $ReleaseNumberPart

    a part (major, minor, build, revision) of the current or specified release number

    Script usage:

    $ReleaseNumberPart(Part, [ReleaseNumber])

    Parameters:

    Name Description
    Part Must be "major" or "1", "minor" or "2", "build" or "3" , "revision" or "4"
    ReleaseNumber Release Number
  • ReleaseVariable (VariableName, [ReleaseNumber], [ApplicationName]) - Gets the value of a variable defined on a release.

    ReleaseVariable

    Gets the value of a variable defined on a release.

    Script usage:

    ReleaseVariable(VariableName, [ReleaseNumber], [ApplicationName])

    Parameters:

    Name Description
    VariableName Variable Name
    ReleaseNumber Release Number
    ApplicationName Application Name

Server

  • $MSBuildToolsPath - The directory of the MSBuild tools, typically in 'C:\Program Files (x86)\MSBuild\{ToolsVersion}\Bin'; if empty, the MSBuildToolsPath registry value under SOFTWARE\Microsoft\MSBuild\ToolsVersions will be used.

    $MSBuildToolsPath

    The directory of the MSBuild tools, typically in 'C:\Program Files (x86)\MSBuild\{ToolsVersion}\Bin'; if empty, the MSBuildToolsPath registry value under SOFTWARE\Microsoft\MSBuild\ToolsVersions will be used.

    Script usage:

    $MSBuildToolsPath
  • $SignToolPath - The full path to signtool.exe; if empty will attempt to resolve the path automatically.

    $SignToolPath

    The full path to signtool.exe; if empty will attempt to resolve the path automatically.

    Script usage:

    $SignToolPath
  • $VsTestExePath - The full path to vstest.console.exe; if empty will attempt to resolve the path automatically.

    $VsTestExePath

    The full path to vstest.console.exe; if empty will attempt to resolve the path automatically.

    Script usage:

    $VsTestExePath

Servers

  • @AcquiredServers (Role) - list of all of the servers acquired for a specified role

    @AcquiredServers

    list of all of the servers acquired for a specified role

    Script usage:

    @AcquiredServers(Role)

    Parameters:

    Name Description
    Role The name of the server role.
  • @AllEnvironments - Returns a list of all environments.

    @AllEnvironments

    Returns a list of all environments.

    Script usage:

    @AllEnvironments

    Example:

    # log all environments in context to the execution log
    foreach $Env in @AllEnvironments
    {
        Log-Information $Env;
    }
    
  • @AllRoles - Returns a list of all server roles.

    @AllRoles

    Returns a list of all server roles.

    Script usage:

    @AllRoles

    Example:

    # log all server roles in context to the execution log
    foreach $Role in @AllRoles
    {
        Log-Information $Role;
    }
    
  • @AllServers ([IncludeInactive]) - Returns a list of all servers.

    @AllServers

    Returns a list of all servers.

    Script usage:

    @AllServers([IncludeInactive])

    Parameters:

    Name Description
    IncludeInactive If true, include servers marked as inactive.

    Example:

    # log all servers in context to the execution log
    foreach $Server in @AllServers
    {
        Log-Information $Server;
    }
    
  • $EnvironmentVariable (EnvironmentVariableName) - Returns the value of the specified environment variable on the current server.

    $EnvironmentVariable

    Returns the value of the specified environment variable on the current server.

    Script usage:

    $EnvironmentVariable(EnvironmentVariableName)

    Parameters:

    Name Description
    EnvironmentVariableName The name of the environment variable.

    Example:

    # get the PATH on the server in context during an execution
    set $Path = $EnvironmentVariable(PATH);
    Log-Information $Path;
    
  • $RoleName - name of the current server role in context

    $RoleName

    name of the current server role in context

    Script usage:

    $RoleName
  • $ServerName - name of the current server in context

    $ServerName

    name of the current server in context

    Script usage:

    $ServerName
  • @ServersInEnvironment ([EnvironmentName], [IncludeInactive]) - Returns a list of all the servers in the specified environment name.

    @ServersInEnvironment

    Returns a list of all the servers in the specified environment name.

    Script usage:

    @ServersInEnvironment([EnvironmentName], [IncludeInactive])

    Parameters:

    Name Description
    EnvironmentName The name of the evironment. If not supplied, the current environment in context will be used.
    IncludeInactive If true, include servers marked as inactive.
  • @ServersInRole ([RoleName], [IncludeInactive]) - Returns a list of servers in the specified role.

    @ServersInRole

    Returns a list of servers in the specified role.

    Script usage:

    @ServersInRole([RoleName], [IncludeInactive])

    Parameters:

    Name Description
    RoleName The name of the server role. If not supplied, the current role in context will be used.
    IncludeInactive If true, include servers marked as inactive.
  • @ServersInRoleAndEnvironment ([RoleName], [EnvironmentName], [IncludeInactive]) - Returns a list of all the servers in the specified role and environment name.

    @ServersInRoleAndEnvironment

    Returns a list of all the servers in the specified role and environment name.

    Script usage:

    @ServersInRoleAndEnvironment([RoleName], [EnvironmentName], [IncludeInactive])

    Parameters:

    Name Description
    RoleName The name of the server role. If not supplied, the current role in context will be used.
    EnvironmentName The name of the evironment. If not supplied, the current environment in context will be used.
    IncludeInactive If true, include servers marked as inactive.

Strings

  • $Coalesce - Returns the first argument which does not contain only whitespace.

    $Coalesce

    Returns the first argument which does not contain only whitespace.

    Script usage:

    $Coalesce
  • $HtmlEncode (Text) - Encodes a string for use in HTML.

    $HtmlEncode

    Encodes a string for use in HTML.

    Script usage:

    $HtmlEncode(Text)

    Parameters:

    Name Description
    Text The text to encode.
  • $Join (Separator, Values) - Concatenates all elements of a list into a string using a specified separator.

    $Join

    Concatenates all elements of a list into a string using a specified separator.

    Script usage:

    $Join(Separator, Values)

    Parameters:

    Name Description
    Separator The string to use as a separator. The separator is only included if the list contains more than one element.
    Values The elements to concatenate.

    See also:

  • $JSEncode (Text) - Encodes a string for use as a JavaScript literal.

    $JSEncode

    Encodes a string for use as a JavaScript literal.

    Script usage:

    $JSEncode(Text)

    Parameters:

    Name Description
    Text Text
  • $MatchesRegex (Text, RegexPattern) - Returns true when the specified text matches the specified pattern; otherwise returns false.

    $MatchesRegex

    Returns true when the specified text matches the specified pattern; otherwise returns false.

    Script usage:

    $MatchesRegex(Text, RegexPattern)

    Parameters:

    Name Description
    Text The text which will be evaluated by the regular expression.
    RegexPattern The regular expression pattern.
  • $NewLine ([WindowsOrLinux]) - newline string for either the operating system of the current server in context or specifically Windows or Linux

    $NewLine

    newline string for either the operating system of the current server in context or specifically Windows or Linux

    Script usage:

    $NewLine([WindowsOrLinux])

    Parameters:

    Name Description
    WindowsOrLinux Must be either "windows", "linux", or "current". The default value is "current" for the current server.
  • $PadLeft (Text, Length, [PadCharacter]) - Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length.

    $PadLeft

    Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length.

    Script usage:

    $PadLeft(Text, Length, [PadCharacter])

    Parameters:

    Name Description
    Text The input string.
    Length The length of the string to return.
    PadCharacter The character to be inserted as padding. The default is a space.
  • $PadRight (Text, Length, [PadCharacter]) - Returns a new string that left-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length.

    $PadRight

    Returns a new string that left-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length.

    Script usage:

    $PadRight(Text, Length, [PadCharacter])

    Parameters:

    Name Description
    Text The input string.
    Length The length of the string to return.
    PadCharacter The character to be inserted as padding. The default is a space.
  • @RegexFind (Text, MatchExpression, [MatchGroup]) - Finds all matches of a regular expression in a string, optionally returning only a matched group.

    @RegexFind

    Finds all matches of a regular expression in a string, optionally returning only a matched group.

    Script usage:

    @RegexFind(Text, MatchExpression, [MatchGroup])

    Parameters:

    Name Description
    Text The string to search for replacements.
    MatchExpression The regular expression used to search the first argument.
    MatchGroup When specified, the name or index of each match subexpression to return instead of the entire match.
  • $RegexReplace (Text, MatchExpression, ReplaceWith) - Searches for and replaces text in a string using a regular expression.

    $RegexReplace

    Searches for and replaces text in a string using a regular expression.

    Script usage:

    $RegexReplace(Text, MatchExpression, ReplaceWith)

    Parameters:

    Name Description
    Text The string to search for replacements.
    MatchExpression The regular expression used to search the first argument.
    ReplaceWith The substring to replace occurrences of the second parameter with.
  • $Replace (Text, Value, ReplaceWith, [IgnoreCase]) - Searches for and replaces text in a string.

    $Replace

    Searches for and replaces text in a string.

    Script usage:

    $Replace(Text, Value, ReplaceWith, [IgnoreCase])

    Parameters:

    Name Description
    Text The string to search for replacements.
    Value The substring to search for in the first argument.
    ReplaceWith The substring to replace occurrences of the second parameter with.
    IgnoreCase When "true", string comparison will be performed with case insensitivity; the default is "false".
  • @Split (Text, Separator, [Count]) - Splits a string into substrings based on a specified separator.

    @Split

    Splits a string into substrings based on a specified separator.

    Script usage:

    @Split(Text, Separator, [Count])

    Parameters:

    Name Description
    Text String to split.
    Separator String that delimits the substrings in this string.
    Count The maximum number of substrings to return. If not specified, all substrings are returned.

    See also:

  • $Substring (Text, Offset, [Length]) - Returns a segment of another string.

    $Substring

    Returns a segment of another string.

    Script usage:

    $Substring(Text, Offset, [Length])

    Parameters:

    Name Description
    Text The input string.
    Offset The zero-based offset into the first parameter that will begin the segment.
    Length The number of characters in the segment. If not specified, the remainder of the string is used.
  • $ToLower (Text) - Returns a string with all letters converted to lowercase.

    $ToLower

    Returns a string with all letters converted to lowercase.

    Script usage:

    $ToLower(Text)

    Parameters:

    Name Description
    Text The string to convert to lowercase.

    See also:

  • $ToUpper (Text) - Returns a string with all letters converted to uppercase.

    $ToUpper

    Returns a string with all letters converted to uppercase.

    Script usage:

    $ToUpper(Text)

    Parameters:

    Name Description
    Text The string to convert to uppercase.

    See also:

  • $Trim (Text) - Returns a string with all leading and trailing whitespace characters removed, or optionally a set of specified characters.

    $Trim

    Returns a string with all leading and trailing whitespace characters removed, or optionally a set of specified characters.

    Script usage:

    $Trim(Text, ...)

    Parameters:

    Name Description
    Text The input string.
  • $TrimEnd (Text) - Returns a string with all trailing whitespace characters removed, or optionally a set of specified characters.

    $TrimEnd

    Returns a string with all trailing whitespace characters removed, or optionally a set of specified characters.

    Script usage:

    $TrimEnd(Text, ...)

    Parameters:

    Name Description
    Text The input string.
  • $TrimStart (Text) - Returns a string with all leading whitespace characters removed, or optionally a set of specified characters.

    $TrimStart

    Returns a string with all leading whitespace characters removed, or optionally a set of specified characters.

    Script usage:

    $TrimStart(Text, ...)

    Parameters:

    Name Description
    Text The input string.
  • $UrlEncode (Text) - Escapes a string for use in a URL.

    $UrlEncode

    Escapes a string for use in a URL.

    Script usage:

    $UrlEncode(Text)

    Parameters:

    Name Description
    Text The text to escape.

Tfs

  • $TfsDefaultServerName - The name of the server to connect to when browsing from the web UI; otherwise a local agent is used.

    $TfsDefaultServerName

    The name of the server to connect to when browsing from the web UI; otherwise a local agent is used.

    Script usage:

    $TfsDefaultServerName

Xml

  • $XmlEncode (Text) - Encodes a string for use in an XML element.

    $XmlEncode

    Encodes a string for use in an XML element.

    Script usage:

    $XmlEncode(Text)

    Parameters:

    Name Description
    Text The text to encode.