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,

lipotechSys EngAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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:

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...
Kanti PrasadCommented:

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
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:

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

lipotechSys EngAuthor Commented:

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,

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

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.
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

From novice to tech pro — start learning today.