How to Determine Windows' Update Levels Using PowerShell

I need to determine the patch level for each server on my domain. If anyone has a PowerShell script would work to solve this problem, I would appreciate it.  I would like to query the registry, and the Windows directory for any files that indicate the latest patch version.  

Thank you,

Lipotech
lipotechSys EngAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NinjaStyle82Systems AdministratorCommented:
Lipotech,

How do you intend for this to work? there is not patch level number for all of Microsoft update, you could however query for individual patches... unless you are just looking for the version of windows...
0
Kanti PrasadCommented:
Hi

You can use

Get-WmiObject -Class "win32_quickfixengineering" |
Select-Object -Property "Description", "HotfixID",
@{Name="InstalledOn"; Expression={([DateTime]($_.InstalledOn)).ToLocalTime()}}

There are other option in the below link
http://social.technet.microsoft.com/wiki/contents/articles/4197.how-to-list-all-of-the-windows-and-software-updates-applied-to-a-computer.aspx
0
Sudeep SharmaTechnical DesignerCommented:
I think the closest you could get is Using the Powershell module for Windows Update.

You can use Get-WUHistory to get the history of updates installed on a system, then you can parse the output to get the date and KBArticle from the outout.

Windows Update PowerShell Module:
https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

Sudeep
0
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

lipotechSys EngAuthor Commented:
Kanti,

The script you suggested successfully executed.  How can I modify this script to execute across the entire domain on specific servers. I have a text file with a list of servers. I suspect I will need to index this file for all servers within the file and then query the domain for servers within the file and report security updates.  How can I modify the script to accomplish that object.

-------
Get-WmiObject -Class "win32_quickfixengineering" |
 Select-Object -Property "Description", "HotfixID",
 @{Name="InstalledOn"; Expression={([DateTime]($_.InstalledOn)).ToLocalTime()}}


Thank you,

Lipotech
0
Kanti PrasadCommented:
Try the below

Have your  server names in the servers.txt as "Server1","Server2","ServerN"

Save the below code as a .ps1 script -i.e -  yourscript.ps1


$servers = (Get-Content .\servers.txt)

foreach ($server in $servers){

Get-WmiObject -Class "win32_quickfixengineering" |
 Select-Object -Property "Description", "HotfixID",
 @{Name="InstalledOn"; Expression={([DateTime]($_.InstalledOn)).ToLocalTime()}} | Export-Csv -path "C:\youroutputilename.csv"
}


Run as
.\yourscript.ps1
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lipotechSys EngAuthor Commented:
Thank you.  Thank you.  Great response.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.