ironmansoftware / universal-automation

Universal Automation is the PowerShell-first automation platform.
https://ironmansoftware.com/universal-automation/
MIT License
24 stars 4 forks source link

Pass parameter values to script using Invoke-UAScript #63

Closed Windos closed 4 years ago

Windos commented 4 years ago

As a hypothetical: I'm wanting to create a logging script that I can invoke from other scripts.

The logging script takes two parameters, level (verbose, warning, error, etc) and message.

I can set this up and run the script, but if I try to invoke it via Invoke-UAScript I'm unable to provide parameter input, meaning it either has to rely on default values or would wait in a pending state for the required fields.

It'd be great if there was something like a Parameter parameter that accepted a hashtable, this would provide a similar experience to splatting.

adamdriscoll commented 4 years ago

This can be accomplished with dynamic parameters. So you can do someting like.

Invoke-UAScript -Script $Script -Level 'Verbose' -Message 'Hello!'