20 May 2016

Initiating SCCM Actions with Verification

Share

The latest script I am writing requires me to initiate both a software updates scan cycle and a software updates deployment evaluation cycle before continuing with the script. The actions needed to be completed before the script can continue, which is what started me on the path to writing this script. I figured if I was going to write two functions for those actions, I would write functions for the rest of the actions. I do realize there are more actions out there that I could include, but for now, I only included the ones in the Actions tab of the Configuration Manager Properties. Thanks to Eswar Knoeti's blog post, I had a reference to refer to on what log files to scan for the action being taken.

The way these scripts work, they kick off an action and then monitor the log file associated with that action until the completion/failed message appears. I have also included a 5 minute maximum wait time if something goes wrong and the action does not complete successfully, and a new message appears. I have noticed that some actions will not initiate if they have been initiated recently. For those, the status will return as failed.

I was going to originally include parameters so that you could select which functions to execute at command line. I chose not to because I figured that functions will likely be taken from this script to be included in other scripts and it is just as easy to comment out ones you do not want to execute between lines 446 and 456.

This has worked great in my environment. There maybe new messages in the log files that you may encounter that cause the function to not read the log file correctly. If so, please write a comment about that in the blog so that I can update the script. Thanks in advance.