Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Making a subroutine that can be called from multiple PowerShell steps

I have a custom job that checks for compliance with various Registry keys, windows settings, etc. To make it easier to modify in the future, each check is in its own step (mostly PowerShell steps). The output from each check is standard: the first line is the title of the things being evaluated, a second line with the current value, and a third line with a statement about whether it complies or not. Each of the three output lines are (or could easily be) variables. Currently, I have duplicated the output code and pasted them into the end of each PowerShell step. I would like to make an “output” routine and send it the three variables from each step so I don’t have to duplicate the code in each step. What is the best way to accomplish this?

0

Comments

0 comments