I am Dale Hayter, a Microsoft and VMware certified Technical Consultant.

My blog has been built up over the years from my experience of working on an IT helpdesk and also from being out on-site.

Get List of Installed Windows / Office Updates Command Line through Powershell

Now and again you might want to find out what Windows / Office Updates are installed on a particular server.

You can type the command

get-hotfix

in powershell however this will ONLY list windows updates and not updates installed for office etc.

The following script will query the server and then export all hotfixes installed to a CSV file. If Excel is installed on the machine then it will also open the csv in excel. Handy!!!

Save the code below as a .ps1 or copy and paste into powershell..


$InputObject = Read-host -Prompt "Insert Computername to get list of installed updates"
$Report = @()
$filename = "$env:Temp\Report_$(get-date -Uformat "%Y%m%d-%H%M%S").csv"
$InputObject | % {
   $objSession = [activator]::CreateInstance([type]::GetTypeFromProgID("Microsoft.Update.Session",$_))
   $objSearcher= $objSession.CreateUpdateSearcher()
   $HistoryCount = $objSearcher.GetTotalHistoryCount()
   $colSucessHistory = $objSearcher.QueryHistory(0, $HistoryCount)
   Foreach($objEntry in $colSucessHistory | where {$_.ResultCode -eq '2'}) {
       $pso = "" | select Computer,Title,Date
       $pso.Title = $objEntry.Title
       $pso.Date = $objEntry.Date
       $pso.computer = $_
       $Report += $pso
       }
   $objSession = $null
   }
$Report | where { $_.Title -notlike 'Definition Update*'} | Export-Csv $filename -NoTypeInformation -UseCulture
ii $filename

Source