windows update powershell

I needed to list all the missing Windows Updates that have been deployed through Configuration manager. This means, not the ones deployed through WSUS, nor the ones that have NOT been deployed to that specific machine, just get the missing updates that the machine is suppose to have.

The information was not that straight forward to get, but I ended up finding a way to find all the missing updates using PowerShell, WMI and put all of that together into Configuration Manager Configuration Item (and Configuration Manager Baselines).

How to list missing software updates using powershell?

So how do we get the sccm 2012 software updates with powershell? This information can be found a bit anywhere on the internet, and can use thousand of different ways to achieve this goal. (Check out my other Script to retrieve a list of existing Software updates right  here) While this blog post mostly explains how to create a Configuration Item that will return the missing software updates deployed on a machine using PowerShell, I though that this article would be incomplete if we didn’t added the basic of the basics: how to list the software updates using powershell and the Configuration Manager client agent.

 

 

 

How to get Missing software updates using Powershell?

If you have the configuration manager client deployed, you are lucky, because this method will work for you!

In order to get missing the sofware updates using powershell, we can retrieve pretty precise information on deployed updates using the CCM_UpdateStatus class. The function below illustrates that.

 

This function will get you all the updates that are currently missing. But this list might include software updates from WSUS. So we need to filter this one one more down and retrieve only the missing software updates that have been deployed.

How to get the deployed software update groups with powershell?

Now this one was the one that got me the most trouble. Again, the technical part of retrieving the information is never really the difficult part. The most difficult part is where to search for the information.

The most difficult part is not how to get the desired information, but rather more where to get find it in the first place.

To list all the software updates groups that have been deployed to a specefic machine will use the CCM_UpdateCIAssignment WMI class.

 

 

How to get all software updates from a software update group?

Now this was a tricky one! Now that you have all Update groups (Actually, it is the Softwate update group ‘Deployment’), you would like all the Software updates that are assigneg to your computer through that Software Update Group. For that, I have built another function, where I go this time into some XML parsing on data retrieved from the WMI repository. The final version returns an object with all the Updates that are deployed through that software update Group.

 

 

How to get all missing software updates that have been deployed from a specific configuration manager software update group with powerShell?

Now that we have the list of missing software updates, and the list of deployed software update groups (assigned software update group), there rest is just a piece of cake!

 

This PowerShell function will loop through all of the assigned software update groups deployed on a particular machine, and compare the deployed updates, with the missing ones. If one missing update is present in the group, the script break’s out of the loop and output the missing update.

Read more about missing software updates (or not) and powershell right here:

 [/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

About the Author:

Stéphane is a dynamic and passionate Cloud and datacenter Microsoft MVP since. He is the founder of the Basel PowerShell user Group (BPUG), the co-founder of the French Speaking PowerShell UserGroup (FRPSUG), author, blogger, and received the community award "PowerShell Hero" from PowerShell.org. Stéphane has implemented microsoft infrastructure solutions in various countries of Europe and is currently working in Basel / Switzerland. Stéphane help his clients to reduce their global infrastructure costs by implementing Microsft infrastructure solutions by combining great products such as System Center, Windows Server, with heavy automation using Windows PowerShell. Stéphane loves languages, Belgium beer, French cheese and French Wine. If any of these topics are of your interest, don't hesitate to come and say hi.

Leave a Reply

%d bloggers like this: