Invoke-PSUScript - Add tag to job

Is there a way to include a tag in an Invoke-PSUScript command so the job it creates is tagged accordingly? Assume the tags already exist.

Product: PowerShell Universal
Version: 4.2.20



1 Like

Is this something you’d like to know, as well? Ferris Bueller references are always welcome in any scenario, for the record. :slight_smile:

@adam Does this ability exist? Assuming it doesn’t (since I can’t find any way of doing it), I’ve created a feature request: Support for tags on jobs produced by Invoke-PSUScript · Issue #3302 · ironmansoftware/issues · GitHub

The tags on jobs come from the script that was invoked. If you add tags to the script they will be added. That said, I don’t see why we couldn’t implement a -Tags parameter on Invoke-PSUScript.

1 Like

Thank you. Setting a tag on the script wouldn’t work in this case, because (as I mentioned on the feature request) this script is executed (via the API’s Invoke-PSUScript command) by various clients. So, even though the script is the same, who called it will vary, and tagging the script itself with any particular client’s tag (name) would negate the point. If there were a way to receive “tag name” parameter on the API, that we could then use in the Invoke-PSUScript command to tag the resulting job, that would solve the issue I detailed on the feature request.

Now, as you mentioned, the tags are normally based on the tags applied to the script being invoked… so, I don’t know how you want to build that logic - to, I guess, ignore the script’s tag if a tag has been provided in the Invoke-PSUScript command, or combine them. I’ll leave all of that to you.

1 Like