Mike
Mike

Reputation: 111

TFS2015 Powershell on Target Machine

I am trying to pass some data to a remote powershell script within the TFS2015 build step.

My step is calling a remote Powershell script on a target machine. I am passing data as script parameters. The following script parameters are what I have defined.

This parameter list works: -buildVersion $(Build.BuildNumber) -queuedBy $env:USERNAME (but the name is the account running the script)

,but I really want the Build.QueuedBy username to get passed so I have tried:

-queuedBy $(Build.QueuedBy)

….or

-queuedBy $env:BUILD_QUEUEDBY

This does not work. Am I specifying something incorrectly or is there a better way?

I would also like to get some of the Build definition Variables to the remote script as well.

I have displayed the variables available to me with a Command line step running: cmd /k set

Upvotes: 2

Views: 968

Answers (1)

ds19
ds19

Reputation: 3175

In order to get the correct value you need something like this:

$a = Get-Item -Path "Env:BUILD_QUEUEDBY"
$a = $a.Value

Upvotes: 1

Related Questions