locked
Powershell: check hotfixes (Powershell) installed RRS feed

Answers

  • Get-HotFix | Where-Object {$_.HotfixID -eq 'KB2506143' -or $_.HotfixID -eq 'KB2819745'  }

    Jan Hoedt

    • Marked as answer by janhoedt Wednesday, June 3, 2015 10:57 AM
    Wednesday, June 3, 2015 10:57 AM
  • or  if (Get-HotFix | Where-Object {$_.HotfixID -eq 'KB2506143' -or $_.HotfixID -eq 'KB2819745'}) {Return $True}

    Jan Hoedt

    • Marked as answer by janhoedt Wednesday, June 3, 2015 11:17 AM
    Wednesday, June 3, 2015 11:17 AM

All replies

  • Get-HotFix | Where-Object {$_.HotfixID -eq 'KB2506143' -or $_.HotfixID -eq 'KB2819745'  }

    Jan Hoedt

    • Marked as answer by janhoedt Wednesday, June 3, 2015 10:57 AM
    Wednesday, June 3, 2015 10:57 AM
  • or  if (Get-HotFix | Where-Object {$_.HotfixID -eq 'KB2506143' -or $_.HotfixID -eq 'KB2819745'}) {Return $True}

    Jan Hoedt

    • Marked as answer by janhoedt Wednesday, June 3, 2015 11:17 AM
    Wednesday, June 3, 2015 11:17 AM
  • This is much faster:

    Get-HotFix KB2506143,KB2819745


    \_(ツ)_/

    • Proposed as answer by jrv Wednesday, June 3, 2015 3:07 PM
    Wednesday, June 3, 2015 3:07 PM
  • Not only is jrv's answer faster, it's better aligned with best practice. Piping is fantastic, but we don't do it when it isn't necessary. If there's a parameter included with the cmdlet, such as -ID in this instance, then use it before you use a second cmdlet to do your filtering.
    Wednesday, June 3, 2015 3:26 PM
  • if you're just looking for the version of PowerShell installed on the machine $psversiontable is pretty good too, especially since those KBs may not be applicable on different versions of Windows. (e.g. you won't find either one of those KBs on 8.1) 

    $psversiontable.psversion.tostring() will give you the full version to compare to whatever you're looking for

    if you're looking for versions of .NET installed the registry is going to be a better check than get-hotfix. 

    http://www.powershelladmin.com/wiki/Script_for_finding_which_dot_net_versions_are_installed_on_remote_workstations

    Wednesday, June 3, 2015 4:10 PM