PS- Get status report of one or more hotfixes from one or more computers

This script searches for the installation status of one or more hotfixes. You can supply the hotfixes from command line, or type them into the script. It will read a text file for comptuer names, or you can type them from the PS line when you run it. It will write to a log file.

 
 
 
 
 
3 Star
(1)
Add to favorites
Operating System
8/25/2009
E-mail Twitter del.icio.us Digg Facebook
  • tweak for PSVersion 5.1.14393.1198
    1 Posts | Last post June 04, 2017
    • re: https://social.technet.microsoft.com/Forums/en-US/d95bd7d7-c2b1-4375-a44a-e4c7b96b5a8d/missing-patch?forum=winserver8gen
      
      Param( 
        [String[]]$hotFix = @("KB3150513", "KB952286"), 
        [string[]]$computer = (get-content -path c:\fso\servers.txt), 
        [string]$filepath = "C:\fso\hotfx.txt", 
        [switch]$logToFile 
      ) #end Param 
       
      Function Get-HotFixStatus([string]$hotFix, [string]$computer) 
      { 
        Get-WmiObject -class win32_QuickFixEngineering -Filter "HotFixID='$hotfix'" -computername $computer 
      } #end function Get-HotFixStatus 
       
      Function Get-HotFixReport([string[]]$hotFix, [string[]]$computer) 
      { 
        foreach($c in $computer) 
        { 
          foreach ($h in $hotfix) 
          { 
           $status =  $(if(Get-HotFixStatus -hotfix $h -computer $c) {$true} else {$false}) 
           $object = New-Object -TypeName PSObject 
           $object | Add-Member -MemberType NoteProperty -Name Computer -Value $c 
           $object | Add-Member -MemberType NoteProperty  -Name HotFix  -Value $h 
           $object | Add-Member -MemberType NoteProperty -Name Installed -Value $status 
          $object 
          } #end foreach hotfix 
         } #end foreach computer 
      } #end function Get-FixReport 
       
      Function Out-HotFixLog ([string]$filepath) 
      { 
       "Hot Fix Report $(Get-Date)" | Out-File -filepath $filepath -append 
       Get-HotFixReport -hotfix $hotfix -computer $computer |  
       Sort-object -property hotfix |  
       Out-File -filepath $filepath -append 
      } #end function Out-HotFixLog 
       
      # *** Entry Point to Script *** 
       
      "Hot Fix Report $(Get-Date)" 
      Get-HotFixReport -hotfix $hotfix -computer $computer |  
      Sort-object -property computer |  
      Format-Table -Property * -autosize 
       
      # write to text file 
      if($logToFile) { Out-HotFixLog -filepath $filepath }