Forum Discussion
[resolved] Variables are not consistent
- Sep 12, 2024
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
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
- webmasterSANTEESep 13, 2024Copper ContributorMy hero!
Alas, I can't change the order the PowerAutomates Create Job presents the fields. But I can change the order in the powershell script to match how PA presents and it worked like a champ.
Thank you so much for getting me back on path!
~Santee