Start a new topic

SCCM Compliance Data

I wanted to share something that happened recently. This is as good as place as any to share these things so that others may see it and hopefully re-use the info.

Customer wanted to show compliance reports from SCCM in a Dashboard. After a little playing around we found a simple solution. 

I am not a guru of any kind to get into SCCM via PowerShell and neither was the customer. What we ended up doing is running the report he wanted. Figured out he could schedule this report and selected the CSV output. 

Next problem. It is an unstructured CSV file that looks a lot like this. 

Description,This report returns the overall compliance data for a software update group.

Collection Name,Clients in Collection,Prod_Windows10,2226

State,Count of Computers,% of Total,Compliant,1975,88.72
State,Count of Computers,% of Total,Non-compliant,184,8.27
State,Count of Computers,% of Total,Compliance state unknown,67,3.01

Ok, after doing a little playing around, i figure out how to skip over some lines and even then only grab the values i cared about. 

Here is the Script itself. 

$csvPath = 'C:\DemoData\Compliance 1 - Overall compliance.csv'
$csvData = Get-Content -Path $csvPath | Select-Object -Skip 6 |  Out-String | ConvertFrom-Csv | select @{Name= "Title"; Expression = {$_.Details_Table0_Status}},
    @{Name= "Value"; Expression = {$_.Details_Table0_PComputers}}
$csvData | Sort-Object -property Title -des

Basically i am skipping over the first 6 lines. Even then i am only grabbing certain columns from the output. The reason why i am sorting it in descending order is so that the Complain value shows up in Green. After all that only makes sense to me. Without it, the default color was grey. 

I also changed the properties of the column names to match what is required for a Pie chart and the Single Metric views. Another option would be to show this as one widget and then let the user change the view to see the actual numbers. In this case, we elected to show both at the same time. When and if there is more information needed for SCCM, we can simply place it as another widget. 

Now that i have shared this, hopefully you have more SCCM information you would like to see in a dashboard. Let me know. 

Chris Malay

Savision Support Manager

Login or Signup to post a comment