SoftwareUpdates.ps1

Hello everyone!

 

Just coming back from a Customer that had an interesting question which in reality just makes all the sense.

So they have a pre production environment where they test out all Windows patches before going into production.

They just asked me how could they easily move their Update groups from their pre to their production environment, makes a whole lot of sense, right?

Out of the box this is not possible, I mean using the console! But once again, Powershell comes to our rescue and handles this with easy and perfectly.

I’ve just created a script which I’ve named as ‘softwareupdates.ps1’ and that should be run in your origin and then on your destination server.

It will basically create a .csv file with a list of all software updates contained in a specific software update group.

Be advised that:

THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT

WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT

LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS

FOR A PARTICULAR PURPOSE. 

This was created for sample purposes only and posted as a sample, you could use at as a basis for your own script but it's mandatory to change it to fit your needs and environment.

 

Adapt all the required variables and run it!

You will be asked if you want to ‘Export’ or ‘Import’

You should run Export first on the origin server which will create a file called ‘updates.csv’ which will contain all the updates contained inside your origin update group.

 

And the result file should be something like this:

"LocalizedDisplayName","CI_ID"

"Security Update for Windows 8, 8.1 and Windows Server 2012, 2012 R2 (KB2917500)","16781437"

"Update for Windows 8.1 for x64-based Systems (KB3012199)","16812802"

"Windows Malicious Software Removal Tool for Windows 8, 8.1 and Windows Server 2012, 2012 R2 x64 Edition - January 2015 (KB890830)","16813718"

 

Then just go to your destination server and run the script again, now choose the “Import” option:

  

And it’s done!

You now have 2 Update groups in 2 different ConfigMgr servers which have the same name and the same updates inside.

Just be sure you have the catalog properly update and you can see all the updates on both sides so this works.

Paulo

 

 

 

 

 

 

softwareupdates.ps1