I am getting an error in VSTS when I run a powershell script.
I have powershell install on my agent. But I still get this error:
The term 'Get-VstsInput' is not recognized as the name of a cmdlet, function, script file, or operable program.
I am I missing something.
You can access variables in a PowerShell script with $env:VariableName
. The only exception is secret variables. Those have to be explicitly passed into the script via a param
block.
For example, if you had a variable named $(Foo)
, you could access it in a PowerShell script as $env:Foo
. If there are periods in the variable name, they are replaced with underscores. So $(Foo.Bar)
becomes $env:Foo_Bar
.
This also does not apply to PowerShell on Target Machines. If you run a PowerShell script on a remote machine via that task, you have to pass any variables as arguments, as the build agent's environment variables are not populated on the target machine(s).
There is no need to use the VSTS SDK unless you are writing a custom task.
Get-VstsInput
is used for developing build/release tasks (not used for executing script in PowerShell task). More details, you can refer VSTS DevOps Task SDK and vsts-task-lib commands.
$(variableName)
.ls env:
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With