{"id":4550,"date":"2020-04-23T01:02:55","date_gmt":"2020-04-23T01:02:55","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=4550"},"modified":"2022-12-02T03:18:25","modified_gmt":"2022-12-02T03:18:25","slug":"powershell-how-to-report-on-windows-updates-for-a-server-over-a-yearly-period","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/powershell-how-to-report-on-windows-updates-for-a-server-over-a-yearly-period","title":{"rendered":"Powershell &#8211; How to report on Windows Updates for a server over a yearly Period"},"content":{"rendered":"\n<p>For auditing purposes you will need to report on the updates install on a server and the install status.&nbsp;<\/p>\n\n\n\n<p>Below is a&nbsp; powershell script that does just that<\/p>\n\n\n<div class=\"wp-block-wab-pastacode\">\n\t<div class=\"code-embed-wrapper\"> <pre class=\"language-markup code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markup code-embed-code\">$operation=@(\u2018Unk\u2019,\u2019Installation\u2019,\u2019Uninstallation\u2019,\u2019Other\u2019)<br\/>$resultCode=@(\u2018Unk\u2019,\u2019In Progress\u2019,\u2019Succeeded\u2019,\u2019Succeeded With Errors\u2019,\u2019Failed\u2019,\u2019Aborted\u2019)<br\/><br\/>$updateSession=New-Object -ComObject Microsoft.Update.Session<br\/>$updateSearcher=$updateSession.CreateUpdateSearcher() <br\/>$historyCount=$updateSearcher.GetTotalHistoryCount() <br\/>$updateSearcher.QueryHistory(0, $historyCount) | <br\/>    Select-Object Date,<br\/>                @{N=\u2019Operation\u2019;E={$operation[$_.operation]}},<br\/>                @{N=\u2019Status\u2019;E={$resultCode[$_.resultcode]}},<br\/>                Title |<br\/>    Format-Table -AutoSize<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>For auditing purposes you will need to report on the updates install on a server and the install status.&nbsp; Below is a&nbsp; powershell script that does just [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2548,2725,576,2191,3201],"class_list":["post-4550","post","type-post","status-publish","format-standard","hentry","category-research","tag-audit","tag-list","tag-powershell","tag-windows-update","tag-year"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=4550"}],"version-history":[{"count":3,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4550\/revisions"}],"predecessor-version":[{"id":6465,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4550\/revisions\/6465"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=4550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=4550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=4550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}