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!

    Passing bool or switch parameter to PSCall

    Scheduled Pinned Locked Moved Support
    buildmasterpowershell
    3 Posts 2 Posters 174 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

      Hello,

      I am using a global PowerShell script with parameters for things like updating the status of issues that have been deployed.

      This works but I tried introducing a new switch parameter to the script and can't seem to pass the correct value. I tried passing True, true, 1, "`$True", $True - all of these result in either PowerShell thinking it's a string or a "no such variable" complaint from BuildMaster for the case of $True. I also tried omitting a value when the param was of type switch - also doesn't work, the plan doesn't validate.

      I have fixed it by means of using a String which can be either "True" or "False" but this workaround bothers me greatly.

      The full error message is:

      Unhandled exception: System.Management.Automation.ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'useBuildNo'. Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. ---> System.Management.Automation.ArgumentTransformationMetadataException: Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. ---> System.Management.Automation.PSInvalidCastException: Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0.

      Product: BuildMaster
      Version: 5.6.3

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

        Hello Stefan,

        Thanks for the bug report!

        I've filed this as Windows#29 and submitted a pull request with a fix.

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

          Awesome Ben, thanks for the quick action!

          I've followed the issue, will I get an automated notification when it's known in which version the fix is going to be available?

          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