5

Quick Tip - Get All The Security Patches Installed On A Server Since A Specific...

 2 years ago
source link: https://thomasrayner.ca/quick-tip-get-all-the-security-patches-installed-on-a-server-since-a-specific-date/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Quick Tip - Get All The Security Patches Installed On A Server Since A Specific Date

Recently, I needed to get a list of all the security patches I’d installed on a group of servers in the last year. It turns out that there’s a WMI class for this and it’s super easy to retrieve this info.

get-wmiobject win32_quickfixengineering -ComputerName $CompName | ? { $_.InstalledOn -gt (get-date).addyears(-1) }

In the win32_quickfixengineering class, you’ll find all the security patches installed on a system. One of the properties is the InstalledOn attribute which more recent than a year ago.

If you have a list of servers to do this for, this is still really easy.

$svrs = @"
server1
server2
server3
"@

$svrs.split("`n") | % { get-wmiobject win32_quickfixengineering -ComputerName $_.trim() | ? { $_.InstalledOn -lt (get-date).addyears(-1) } }

Just paste them into a here-string and execute this for each of them.

Written on October 26, 2016

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK