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?

login to comment