Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

Use PowerShell to Identify When Hotfixes Are Installed

$
0
0

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to list when hotfixes are installed.

Hey, Scripting Guy! Question Hey, Scripting Guy! Our corporate security person has tasked my manager with finding out about the number of hotfixes released by Microsoft each month. My manager, of course, passed the buck to me. I think I could probably find the information on the Internet—but dude, I really do not believe everything I read on the Web. Instead, I was wondering if I could find this information from my local system by using Windows PowerShell. By the way, I am running Windows 8.1 with all of the latest patches, updates, and whatever’s from Microsoft. Can you hook me up?

—SK

Hey, Scripting Guy! Answer Hello SK,

Microsoft Scripting Guy, Ed Wilson, is here. It is an absolutely lovely day down here in Charlotte, North Carolina in the southern portion of the United States. I mean, absolutely lovely. I am sitting outside on the porch, sipping a delightful cup of English Breakfast tea. I put in some lemon grass, jasmine, orange peel, and hibiscus flower. I also added a cinnamon stick for sweetness. The tea is robust and complex. If I close my eyes, it feels like I am in Florida, and I can hear the seagulls squawking. The breeze coming across the lawn adds to this effect. I am checking my email via my Surface Pro 3.

Use the Get-Hotfix cmdlet

It is easy to gather hotfix information on Windows 8.1 (and Windows 8, Windows Server 2012 R2, and Windows Server 2012). All I need to do is to use the Get-Hotfix cmdlet.

When I use the Get-Hotfix cmdlet, it returns the source of the information (my computer name), the type of update, the Hotfix ID, who installed the hotfix, and when it was installed. This information returns by default. The command and a typical output are shown here:

Image of command output

If I pipe the output to the Format-List cmdlet, select all of the properties, and use the –Force parameter to reveal any hidden properties, I can see that there are indeed other properties available. By a quick inspection, I can also see that the properties that contain information I am concerned with are displayed by default. Here is the output for one hotfix:

Image of command output

Finding only when hotfixes are installed

To answer the question about how many hotfixes per month are installed, I can use the Get-Hotfix cmdlet and pipe the results to the Group-Object cmdlet. I can then select the InstalledOn property as the property upon which to group. I can also get rid of the elements to have a cleaner display. Here is the command:

Get-HotFix | Group installedon –NoElement

The command and its associated output are shown here:

Image of command output

This looks pretty good, but it is a bit random. I want to sort by the Name column (which is the date the hotfix was installed). Here is my command:

Get-HotFix | Group installedon -NoElement | sort name

Here is the command and the associated output:

Image of command output

Cool. Now I have a list of the number of hotfixes that were installed and a sorted list of dates. I can see that in August 2014, there were three separate hotfix collections of 2, 13, and 1 (a total of 16 hotfixes for August).

SK, that is all there is to using Windows PowerShell to find hotfixes installed by month. Join me tomorrow when I will talk about more cool Windows PowerShell stuff.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>