{"id":556,"date":"2014-10-10T00:01:00","date_gmt":"2014-10-10T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/10\/10\/use-powershell-to-identify-when-hotfixes-are-installed\/"},"modified":"2014-10-10T00:01:00","modified_gmt":"2014-10-10T00:01:00","slug":"use-powershell-to-identify-when-hotfixes-are-installed","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-identify-when-hotfixes-are-installed\/","title":{"rendered":"Use PowerShell to Identify When Hotfixes Are Installed"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to list when hotfixes are installed.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;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&mdash;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&nbsp;8.1 with all of the latest patches, updates, and whatever&rsquo;s from Microsoft. Can you hook me up?<\/p>\n<p>&mdash;SK<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Hello SK,<\/p>\n<p>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&nbsp;3.<\/p>\n<h2>Use the Get-Hotfix cmdlet<\/h2>\n<p>It is easy to gather hotfix information on Windows&nbsp;8.1 (and Windows&nbsp;8, Windows Server&nbsp;2012&nbsp;R2, and Windows Server&nbsp;2012). All I need to do is to use the <b>Get-Hotfix<\/b> cmdlet.<\/p>\n<p>When I use the <b>Get-Hotfix<\/b> 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:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-01.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>If I pipe the output to the <b>Format-List<\/b> cmdlet, select all of the properties, and use the <b>&ndash;Force<\/b> 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:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-02.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-02.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<h2>Finding only when hotfixes are installed<\/h2>\n<p>To answer the question about how many hotfixes per month are installed, I can use the <b>Get-Hotfix<\/b> cmdlet and pipe the results to the <b>Group-Object<\/b> cmdlet. I can then select the <b>InstalledOn<\/b> 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:<\/p>\n<p style=\"margin-left:30px\">Get-HotFix | Group installedon &ndash;NoElement<\/p>\n<p>The command and its associated output are shown here:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-03.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-03.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>This looks pretty good, but it is a bit random. I want to sort by the <b>Name<\/b> column (which is the date the hotfix was installed). Here is my command:<\/p>\n<p style=\"margin-left:30px\">Get-HotFix | Group installedon -NoElement | sort name<\/p>\n<p>Here is the command and the associated output:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-04.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-10-14-04.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>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).<\/p>\n<p>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.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to list when hotfixes are installed. &nbsp;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 [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[31,3,203,45],"class_list":["post-556","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-operating-system","tag-scripting-guy","tag-service-packs-and-hotfixes","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to list when hotfixes are installed. &nbsp;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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/556\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}