Jun 8, 2017

How to rollup ConfigMgr Software Updates for reporting

So you got an Automatic Deployment Rule (ADR) in place and Software Updates being automatically deployed once a week. We're half way this year and you've got something like 20-30 Software Update Groups (SUG) being deployed, do'h! SUG's are named perhaps something like 'Windows Updates Automatic Deployment 2017-05-09 10:05:22' - depending the naming convention you have in you ARD

How to rollup those updates to just one group per month or per year? With PowerShell, of cource!

First you need a SUG for all updates, lets call it "All Updates". Yes, I know, how clever! Then you need SUG for each month. Let's just cheat a little, go ahead and rename one of your monthly SUG's to '....2017-05' leaving out the day and time part of the name. This group will be the monhly group of May.

And the the magic! Just connect to your SCCM via PowerShell and run this script, modifying it by changing your own CM sitecode and the names of source and rollup groups:

Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1"
Set-Location "L01:"

$SourceGroup = 'Windows updates automatic deployment 2017-05-*'
$RollupGroup = 'Windows updates automatic deployment 2017-05'
$AllUpdatesGroup = 'All Updates'

$ListOfUpdates = (Get-CMSoftwareUpdateGroup | where {$_.LocalizedDisplayname -like $SourceGroup}).Updates

Write-Verbose "Adding to rollup group"
Add-CMSoftwareUpdateToGroup -SoftwareUpdateId $ListOfUpdates -SoftwareUpdateGroupName $RollupGroup -Verbose

Write-Verbose "Adding to All Updates group"
Add-CMSoftwareUpdateToGroup -SoftwareUpdateId $ListOfUpdates -SoftwareUpdateGroupName $AllUpdatesGroup -Verbose

 This script will just pick all the updates from the source groups and throw them to the rollup groups. Later you can then just delete the source groups, leaving one group per month and big 'All Updates' group for reporting etc.

And as always, if you have any comments please send me a tweet @arisaastamoinen

Cheers, Ari

No comments:

Post a Comment