How to Get a List of Installed Updates and Hotfixes

How do I get a list of installed updates and hotfixes?

You can use IUpdateSession3::QueryHistory Method.

The properties of the returned entries are described at http://msdn.microsoft.com/en-us/library/aa386400(VS.85).aspx

Set updateSearch = CreateObject("Microsoft.Update.Session").CreateUpdateSearcher
Set updateHistory = updateSearch.QueryHistory(1, updateSearch.GetTotalHistoryCount)

For Each updateEntry in updateHistory
Wscript.Echo "Title: " & updateEntry.Title
Wscript.Echo "application ID: " & updateEntry.ClientApplicationID
Wscript.Echo " --"
Next

edit: also take a look at http://msdn.microsoft.com/en-us/library/aa387287%28VS.85%29.aspx

How do I generate a list of windows patches and the date they were installed on a windows 2000 server?

Option 1
Get psinfo from http://technet.microsoft.com/en-us/sysinternals/bb897550.aspx

Run psinfo -h to get the list of hotfixes

Option 2
Another method that doesn't require 3rd party software using wmic; just type:
wmic qfe from the command line. The default output gives really long lines, so you might be better off redirecting to a file and viewing it in your favourite text editor.

Variations on a theme include:

  • wmic qfe list full
  • wmic qfe get HotfixID,ServicePackInEffect,InstallDate,InstalledBy,InstalledOn
  • wmic qfe where "HotfixID = 'KB973687'"
  • wmic qfe where "HotfixID = 'KB973687'" get HotfixID, InstallDate, InstalledBy, InstalledOn
  • wmic qfe where "HotfixID = 'KB973687'" list full
  • wmic /node:myserver qfe list full

Option 3
Use Powershell to do the same thing. This is simply:

  • Local: get-wmiobject -class win32_quickfixengineering
  • Remote: get-wmiobject -class win32_quickfixengineering -computername mysever

Again, this can take filters, for example:

  • get-wmiobject -class win32_quickfixengineering -filter "HotfixID = 'KB979683'"

...or as it's Powershell, just pipe through where-object.

Option 4
It looks like recent versions of Windows don't use QFE in the same way. If it looks like you have an incomplete list, then you can try this instead:

$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$Searcher.Search("IsInstalled=1").Updates | ft -a Date,Title

(source for this brief script: an answer on Superuser for Why are “get-hotfix” and “wmic qfe list” in Powershell missing installed updates?).

Programmatically get a list of all installed updates in Windows

The problem with qfe is that newer Windows versions have updates for componentes which aren't CBS related, hence wmic path Win32_QuickFixEngineering will not show them.

The trick is to use a COMObject to the updater system.
I've written a small package that does the job, and checks for updates via COM, WMI and registry.

Talking to windows update via COM gives the most information.
WMI gives some information, and registry of course only gives the KB and install date.

Install with

pip install windows_tools.updates

Use with

from windows_tools.updates import get_windows_updates

for update in get_windows_updates(filter_duplicates=True):
print(update)

The duplicate filter is enabled because of AV definition updates that show alot.

Viewing a list of Installed Hotfixes/Patches using wmic (HotfixID, InstalledOn and Description)

Does this help?

@For /F "Skip=2 Tokens=1,* Delims=," %%G In ('%SystemRoot%\System32\wbem\WMIC.exe QFE Get Description^, HotFixID^, InstalledOn /Format:CSV 2^>NUL') Do @For /F "Tokens=1-3 Delims=," %%I In ("%%H") Do @Echo %%J installed on %%K - %%I

How to get Windows installed updates

WUA API only lists updates installed through Windows Updates Services.

To list other kind of updates you may use Windows Installer API, specifically:

  • MsiEnumPatchesEx()
  • MsiGetPatchInfoEx()

how to get a full list of windows view installed updated using Get-WmiObject as its appears in control panel

This is how I retrieve update information from local/remote workstations using the ComObject Microsoft.Update.Session to retrieve update history.

function Get-UpdateInformation
{
param
(
$ComputerName
)

$ScriptBlock = {
$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$Search = $UpdateSession.CreateUpdateSearcher()
$History = $Search.GetTotalHistoryCount()
$Search.QueryHistory(0, $History) | Select-Object Title,Description,Date,@{N='Operation'; e={
switch($_.Operation)
{
1 {"Install"}
2 {"Uninstall"}
3 {"Other"}
}
}
}
}
$CommandSplat = @{ScriptBlock = $ScriptBlock}

if($ComputerName)
{
$CommandSplat.Session = New-PSSession $ComputerName
}
Invoke-Command @CommandSplat
if($CommandSplat.Session)
{
Remove-PSSession $CommandSplat.Session
}
}

Run it either as Get-UpdateInformation or Get-UpdateInformation -ComputerName Computer

If you want to explore all the properties available, change this line

$Search.QueryHistory(0, $History) | Select-Object Title,Description,Date,@{N='Operation'; e={ 

to

$Search.QueryHistory(0, $History) | Select-Object -ExcludeProperty Operation -Property *,@{N='Operation'; e={ 

Get list of full installed updates in PC

Try this below link help with you:

https://social.msdn.microsoft.com/Forums/en-US/bece1e5d-0d5a-44c2-85c8-a23633d69388/how-to-retrieve-windows-installed-updates-through-resigtry-using-c?forum=csharplanguage



Related Topics



Leave a reply



Submit