Forum Discussion

webmasterSANTEE's avatar
webmasterSANTEE
Copper Contributor
Sep 12, 2024

[resolved] Variables are not consistent

Hello internet.   My mind is completely blown by this!   I have a PowerAutomate that sets some 'compose' actions and then uses them to start a job.  It is a PowerShell 7.2 script running in a Run...
  • LainRobertson's avatar
    Sep 12, 2024

    webmasterSANTEE 

     

    This is expected when named parameters aren't explicitly specified in a call to a PowerShell script, function or commandlet. In such a scenario, any supplied parameter values are mapped to parameter declarations in the order passed.

     

    Using your script definition, this would be the correct way to call it using named parameters:

     

    Invoke-MyScript -siteName "siteValue" -OMd "omdValue" -userNAME "usernameValue" -templateNAME "tempnameValue";

     

    But you are likely calling it like this - which is supported by the matching order of your input variables and subsequent output:

     

    Invoke-MyScript "siteValue" "usernameValue" "tempnameValue" "omdValue";

     

    Either re-order your input variables or use name parameters to resolve the issue.

     

    Cheers,

    Lain

Resources