locked
PSCredential messing with Dynamic Param RRS feed

  • Question

  • So I am working on a function and I have 2 PSCredential Parameters, 2 string Parameters, and 1 dynamic Parameter. When trying to run the Function I give it

    Test-Function -Cred1 $cred1 -Cred2 $cred2 -String1 $string1 -String2 $string2 

    and when putting it through like that the dynamic parameter stops appearing after the first credential parameter. If I do it like this:

    Test-Function -DynParam DynValue 

    I can use the rest of the parameters just fine. I tried using Positional Bindings and that still didn't work. Tried using [CmdletBinding(PositionalBinding=$false)] and that did not solve the problem either. The dynamic parameter is set to be used with all parameter sets and I only have this issue with this one function. Other functions that do not request a PSCredential parameter work as it should. They allow the Dynamic Parameter to be used anywhere in the function. Any ideas? Also, I noticed that if I don't provide any values and just add the parameters when calling the function it allows the dynamic parameter to appear. It is only after providing a value to the credential parameters that it disappears as an option.

    Wednesday, September 19, 2018 4:13 PM

All replies

  • Hi Tohrment,

    Thanks for your question.

    Please post the code you defined your function's parameter.

    Best Regards,

    Lee


    Just do it.

    Thursday, September 20, 2018 2:59 AM
  • Hi,

    Just checking in to see if the information provided was helpful. 
    Please let us know if you would like further assistance.

    Best Regards,
    Lee

    Just do it.

    Tuesday, September 25, 2018 9:28 AM