$ArgumentList vs $args

When using -ArgumentList with PowerShell commands, such as Invoke-Command, I have always referred to the variables within the scriptblock using the $args variable with the appropriate index (e.g. $args[0]). I’ve learned that with UniversalDashboard, I have to use $ArgumentList rather than $args. I would like to understand how / why that is. In this particular case, I am using the New-UDTable cmdlet, but would assume it’s true of the other UD cmdlets. Thanks.

It’s due to the fact that $args in internally set by powershell when running the UD Endpoints and gets overriden when UD tries to set it. The use of $ArgumentList was done to avoid that. That said, I bet we can fix this to use $args…I would need to revisit the behavior.

1 Like