Long time since I wrote a blog – been uber busy – but found time to slip this one in! Working with ConfigMgr a lot I have a number of html-style email reports written in PowerShell that get data from the SCCM database and send it to me and other SCCM admins. Personally, I much prefer getting a regular email containing useful information than to use the canned SSRS reports, or checking the SCCM console.
Below is a template script that can be used to send regular reports containing SQL data with a simple SQL query as an example. Simply create a scheduled task on an admin server to run the report regularly, using an action like:
PowerShell.exe -ExecutionPolicy Bypass -WindowStyle Hidden – File MyScript.ps1
The email from this example looks like:
The script uses a custom html style and a publically available css file to provide the formatting (this does mean internet access is required).
To use the script, you need the relevant permissions to query your SQL database and enter the SQL details at the top of the script, as well as your email parameters. Add your SQL query, update the headers in the ConvertTo-Html cmdlet and you’re away.
Ciao for now!
Recently I discovered that hardware inventory was broken on our ConfigMgr clients. The tell-tale sign was that the hardware inventory action was missing from the ConfigMgr client control panel. Checking my ConfigMgr Client Health report I found that none of our systems had reported hardware inventory for over a week!
The problem was traced to the fact that someone had updated the configuration.mof file but had not reflected the changes in the classes being inventoried in the Client Settings.
What concerned me the most however, was that we had no visibility that hardware inventory was broken, and since we are not actively using any dashboard with this information I decided to create an html-styled email report that can run as a scheduled task to give me regular visibility of key aspects of client health in our environment.
This report complements the previously mentioned Client Health report by giving a simple overview of client health status. If further information is required the Client Health report can then be consulted.
The summary report can be found here:
I hope you may find it helpful!