4

I'm running this script script (as discussed here):

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

However, the Search() method takes up to 10 minutes on some of the machines I'm testing on!

  • Why is this so slow? The list in Control Panel -> Programs and Features -> Installed Updates only takes a few seconds.
  • Can I make this faster? I'm only looking to see if one particular update is in the list.
  • What format is the "IsInstalled=1" query in? If I make a mistake, Search() returns all updates, which isn't very helpful. Edit: Documentation is here - IUpdateSearcher::Search method
a paid nerd
  • 3,332
  • 6
  • 30
  • 32
  • It's probably (also) searching remotely. What are you actually trying to accomplish? – Daniel B Nov 21 '15 at 01:01
  • @DanielB I'm trying to see if a particular update is installed -- that's all I need. I can't use `Get-Hotfix` because [sometimes it's incorrect](http://superuser.com/questions/1002015). – a paid nerd Nov 21 '15 at 01:02
  • 1
    For now, check if the `systeminfo` command is right enough. – Daniel B Nov 21 '15 at 01:04
  • @DanielB I was excited to try this, but `systeminfo` appears to miss hotfixes just like `Get-Hotfixes` does. (I have a Win8.1 host here that shows four hotfixes with `systeminfo` and `Get-Hotfixes`, but I get the full list in Programs and Features and by using `CreateUpdateSearcher()`. – a paid nerd Nov 23 '15 at 18:35
  • @PJMahoney Thanks! Looks like others have found similar problems. – a paid nerd Nov 23 '15 at 18:37
  • found any better working solution? For me it takes hours.. – David Trevor Aug 22 '17 at 09:33
  • @taclight No, I never found a solution to this. :( – a paid nerd Aug 29 '17 at 23:49
  • @apaidnerd oh well then I'll just continue trying to apply any given update and see if it works or doesn't :D – David Trevor Aug 30 '17 at 07:17
  • I've found "QueryHistory()" to be much faster. Check here: https://social.technet.microsoft.com/wiki/contents/articles/4197.windows-how-to-list-all-of-the-windows-and-software-updates-applied-to-a-computer.aspx – galaxis Jan 31 '19 at 13:20

0 Answers0