Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Powershell List all Patches Updates on a Server

23 June,2012 by Tom Collins

I was troubleshooting a SQL Server problem . I was stuck , as I couldn’t  remember making any changes. I started investigating any patch updates on the server.  Powershell and the Microsoft.Update.Session object do a go job on returning the patch list.

From discovering the latest patches updated , I was able to investigate what changes occurred.

This script lists all the patches/updates installed on the server

$MicrosoftUpdateSession = New-Object -ComObject Microsoft.Update.Session 
$SearchResult = $null
$UpdateSearcher = $MicrosoftUpdateSession.CreateUpdateSearcher()
$UpdateSearcher.Online = $true
$SearchResult = $UpdateSearcher.Search("IsInstalled=1 and Type='Software'") 

$x = 1
foreach($Update in $SearchResult.Updates)
{
	Write-Host "$x : $($Update.Title + " - " + $Update.SecurityBulletinIDs)"
	$x += 1
}

Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Powershell List all Patches Updates on a Server


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer