"View installed updates" equivalent of powershell cmdlet

Hi everyone,

I want to know how to get a list of installed updates on remote computer via powershell. I want to check the package name, publisher, installDate, size, version. just like the list in “View installed updates” ? how to implement that in powershell?

thanks in advance.

Packages and updates are two different things.

Get-Package and Get-Hotfix are the respective commands and you can use invoke-command to run them remotely.

Get-Package doesn’t show me the installation datetime. and get-hotfix doesn’ give me a full list of items, looks like it just show me the hotfix for windows OS, not include the application update. e.g MS office.

Office update and apps update are not treated as hotix etc. So here there is not any cmdlet to find those. Those are inside system treated as application.

Get-Package does show installed on date. It is not immediately apparent. It is stored in an property called MetaData with a key of “installeddate”

$packages = Get-Package
$installstring = $packages[0].MetaData["installeddate"]
Write-Output ("Name: $($packages[0].name), Installed: $installstring")

I think you have a typo here. Should be [“InstallDate”] ??

1 Like

No it’s installeddate
You can type $Packages[#].Meta to see which meta fields are available per package

Interesting … mine clearly states InstallDate and fails with InstalledDate.

Thanks for the clarification.

Are you sure you’re using Get-Package and not Get-HotFix? :wink:

Here is my output:

PS C:\> (Get-Package)[0].MetaData["InstallDate"]
PS C:\> (Get-Package)[0].MetaData["InstalledDate"]
PS C:\>

Please show me the error of my ways :slight_smile:
Also, I am on PS 5.1.

That seems to be the difference. On version 5.1 it is InstallDate and on version 7.x it is InstalledDate

What is really odd on my system is Get-Package returns nothing on PS 7.3.0 so I could not test. And yes, I ran as admin.

Anyway, thanks Olaf :slight_smile:

Wait a second … it get’s weirder … the version I tested it on was 7.3.2 and I ran it even without elevation. :crazy_face:

Completely untested, but as Windows allows user and system installs it begs the question do both install locations get pulled by Get-Package or does un-elevated pull user and elevated pull system. Both locations would be user readable and neither technically needs elevated rights to view

MS should make the “InstallDate” as the default output column, at least be a simple property of package object.

FWIW I use this to get a list of updates on a computer:

$Session = New-Object -ComObject Microsoft.Update.Session
	$Searcher = $Session.CreateUpdateSearcher()
	$HistoryCount = $Searcher.GetTotalHistoryCount()
	$updates = $Searcher.QueryHistory(0, $HistoryCount) | sort date