Hi All,
I'm looking for a PowerShell script that help me manage my Windows servers who receive updates from our internal WSUS server. We are using WSUS 3.0 running on a single Windows 2012 R2 machine.
In simple terms, I need a PowerShell script that can produce a simple table showing the following:
- The date of the most recently installed update for each server
- Email these results to a specified email address.
I am not interested inwhich update was installed – I am only concerned about when the last update was installed on each server.
I have seen a very good script posted by Aman Dhally on his IT blog, the script does exactly what I need (minus the emailing part), but it only returns results for the machine where the script is run from, here is the script:
First enter:
$windowsUpdateObject=New-Object-ComObject Microsoft.Update.AutoUpdate
Then enter:
$windowsUpdateObject.Results
This produces a very simple table showing the date of the last successful update that was installed.
(to my frustration I cannot post URL's or images of the result, as my account has yet to be verified!)
What I would like is for the above to query a list of my Servers and produce the results exactly in the same way as above, one line per server. So column 1 =computername, column 2=LastSearchSuccessDate, column 3=LastInstallationSuccessDate
For example, I have a text file: C:\Computers.txt, which contains a list of all my Windows Servers. Would it be feasible to produce a script that could say get-content c:\Computers.txt and for each computer listed, show me the date of the most recent Windows Update that was installed?
I hope this makes sense, I’d be grateful for any assistance. I should add that I’m a PowerShell newbie, so there is still a lot to learn for me.
Many thanks