Patch Tuesday with PowerShell

It’s actually Wednesday here, but yesterday was another “Patch Tuesday” and Microsoft released its update packages.

So – it’s time to patch! šŸ˜Š

Not sure how you’re patching your machines, but just wanted to make you aware of the nice PowerShell module called PSWindowsUpdate.

You can read more about it on the official PowerShell Gallery page and also here.

In short – this module takes care of controlling Windows Update from within PowerShell on your local and also remote machines.

And… I know it’s not nice like the Windows Update screen, but it does its job! šŸ˜Š

To make use of it, you’ll have to take care of some minor prerequisites and install it via PowerShell Gallery.

Once done, you can use it to control Windows Update:

To make it easier for you, here is the installation script which takes care of… everything:

And that’s it – we’re done!

Happy patching!

Cheers!

Updates and Recommendations not working in SCOM 2016

Not so long ago, there was a thread about this issue on TechNet Forums ā€“ long story short, in some cases (if you didnā€™t do a clean installation of System Center 2016 ā€“ Operations Manager, for example), the shiny, new feature called Updates and Recommendations didnā€™t work.

Even better ā€“ there was a rather cryptic error saying ā€œAn error occurred while displaying the Updates and Recommendations view. This might be because the database query has encountered an errorā€¦ā€.

image

Soā€¦ it looks that maybe the database query has indeed ā€œencountered an errorā€.

What can we do to make sure and resolve this?

As the user Chandra Bose suggested, we can look for duplicates in our imported management packsā€¦ and maybe we will be smarter then.

PowerShell command we can use:

This will list our imported management packs and their versions, and we can start looking for duplicate(s).

image

In my case, there were some ā€“ some of them were the two management packs called Microsoft.SystemCenter.WebApplicationSolutions.Library.Resources.*.

To get a better look on those two, we can use the following command:

And the output looks like this:

image

image

image

This shows that we really have two ā€œduplicateā€ management packs in our SCOM database, one installed in 2013, and another in 2014 (why? and how? donā€™t really matter Smile). We need to remove one, obviously.

For that, we can use the following command (by using the Id property from previous command):

And, if there are no more duplicates, our Updates and Recommendations view should work now:

image

Hope this helps.

Cheers!