A few things worthy of note:
- I've pretty much standardized on using that logging boilerplate for most of my scripts. It makes it easy to log errors and insert debug statements at the code as I'm writing so that I can always set -loglevel to 'debug' later when troubleshooting.
- I made the caller pass the name of the mrinit.conf file so that I could create one small SCCM package for the script with all five different mrinit.conf files.
- If you decide to do this, don't use the mrinit.conf file from the root of the package directory on the Update server. There should be an mrinit.conf file in the rms subfolder. Use that one. If it isn't there, then you might not be configured to use a message relay, and this script won't help you until you are.
WARNING! ACHTUNG! AVISO! LUU Y!
I am doing the QA and testing for my organization. I make no guarantees that this script will work for yours. Sophos is a temperamental beast, and you should do the due diligence to test and do the QA and do whatever modifications it takes to make it work for yours. You may also wish to consult with your Sophos TAM before undertaking a project like this.