Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Defining a script asset for output parameters accessed by PSCall

    Scheduled Pinned Locked Moved Support
    powershellbuildmaster
    3 Posts 2 Posters 16 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      I understand that PSCall has the ability to access output parameters from the script asset being called. What I don't understand is is how to define the script so that it has output parameters that will be accessible to PSCall.

      I'm very familiar with powershell. I've tried creating a script asset parameter with a [ref] parameter but that didn't work the way I did it.

      By the way, the docs for PSCall include a reference to an hdars script. It would be nice if the content of the hdars script was included in the docs for PSCall as well.

      Product: BuildMaster
      Version: 5.6.9

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        Here's what I've come up with, though I can't vouch for its correctness. It would appear that output parameters with PSCall are simply normal script variables that you tell PSCall to pull out of the script context at the end of execution. It may say this in the docs and I just read over it.

        Script Asset named 'say-hello.ps1' in an application named 'Prototyping'.

        param([string]$name)
        
        $hello = "hello {0}" -f $name
        

        PSCall operation in plan

         PSCall Prototyping::say-hello
         (
            name: '"mary"',
            hello => $output
         );
        

        After the execution of the PSCall operation, the $output variable contains:

        Hello mary
        
        1 Reply Last reply Reply Quote 0
        • benB Offline
          ben inedo-engineer
          last edited by

          Correct. Output variables don't need to be specially declared.

          However, the next version of the Windows plugin for BuildMaster and Otter will add support for [ref] parameters as output variables in the editor.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post
          Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation