none
Pass values from an external powershell script to an inline script RRS feed

  • Domanda

  • Hi, I have a release definition that runs a powershell script in one task and I would like to pass the value of that script to an inline script in another task in the release definition.  I don't know if this can be done, and if it can I don't know how to do it.

    Any advice would be appreciated!


    Tim

    venerdì 18 ottobre 2019 15:10

Tutte le risposte

  • Of course you can do. Simply save the output of the one script to a variable and provide it for the other script. ;-)

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    venerdì 18 ottobre 2019 15:48
  • Thank you for your reply.  I am relatively new working with releases and am working with VSTS not Azure.  If you could explain in a little more detail how to do this, or point me to an article that does - I would be very grateful!

    Thanks


    Tim

    venerdì 18 ottobre 2019 21:59
  • Hi Tim, I don't know how you want to pass the output of first script to another. I am considering that whole output of first script would be passed as a parameter to second script and you can do that as below:

    $FirstScriptResult=Invoke-Expression -Command ".\Path\to\FirstScript.ps1"
    $command= ".\Path\to\SecondScript.ps1 $FirstScriptResult"
    Invoke-Expression -Command "$command"

    lunedì 21 ottobre 2019 16:19
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    venerdì 8 novembre 2019 13:34
    Moderatore