• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

TECHDIIP

  • Tech
  • Windows
  • Powershell
  • Scripts
  • News
  • Games

Powershell Get Hotfix Installed on Multiple Computers

Here is the simple PowerShell Code that pulls the information of hotfix on multiple computers.

We need to create a text file for remote computers list that we are going to query the port status, here I have created a text file named as allservers.txt and saved it in location C\temp\allservers.txt

$ErrorActionPreference = "silentlycontinue "
$Allservers = Get-Content -Path "C:\temp\AllServers.txt"

foreach ($server in $Allservers)
  {

  $hotfix = $null


$hotfix = New-Object -TypeName psobject
$hotfix = Get-HotFix KB5004945 -ComputerName $server | Select-Object -Property PSComputerName, HotFixID,InstalledBy,InstalledOn
$hotfix | Add-Member -MemberType NoteProperty -Name PSComputerName -Value $hotfix.PSComputerName 
$hotfix | Add-Member -MemberType NoteProperty -Name HotFixID -Value $hotfix.HotFixID 
$hotfix | Add-Member -MemberType NoteProperty -Name InstalledBy -Value $hotfix.InstalledBy
$hotfix | Add-Member -MemberType NoteProperty -Name InstalledOn -Value $hotfix.InstalledOn

    if ($hotfix.PSComputerName -eq $null)
{
    
    $hotfix | Add-Member -MemberType NoteProperty -Name PSComputerName -Value $server  -Force
    $hotfix | Add-Member -MemberType NoteProperty -Name HotFixID -Value "HotFix Not Installed" -Force
    $hotfix | Add-Member -MemberType NoteProperty -Name InstalledBy -Value N/A -Force
    $hotfix | Add-Member -MemberType NoteProperty -Name InstalledOn -Value N/A -Force

}

$hotfix | Export-Csv -Path "C:\temp\Hotfixresult.csv" -Force  -Append -NoTypeInformation
}

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • How do Zoom Application Testing | Working or Not
  • Powershell script to test website status up or down on a local or remote computers
  • Solved: Server execution failed windows 10 Server 2016 and 2019
  • How to Fix windows 10 version 1903 error 0xc1900223
  • Free Music Making Software List One Can Try Out
  • About Us
  • CONTACT US
  • Disclaimer
  • Privacy Policy

Copyright © 2023 techdiip.com