Thursday, April 9, 2015

windows patching date for bulk servers

1. Generate a Report for installed Hotfix-Update-ServicePack for Bulk Servers.
2. Check a specific Hotfix is installed or not in Multiple Computers.
3. Get the latest Patching Date for bulk Computers.

Create computers.txt on C drive with below command. (create servers list, remove spaces if any exist at the end of computer names, copy to excel and past back in txt)
Get-ADComputer -Filter 'OperatingSystem -like "*Server*"' -Properties * |
Select-Object Name | Sort-Object Name > c:\computers.txt

Save below script as .ps1 and execute on DC.
function Hotfixreport { 
$computers = Get-Content C:\computers.txt   
$ErrorActionPreference = 'Stop'   
ForEach ($computer in $computers) {  
 
  try  
    { 
Get-HotFix -cn $computer | Select-Object PSComputerName,HotFixID,Description,InstalledBy,InstalledOn | FT -AutoSize 
  
    } 
 
catch  
 
    { 
Write-Warning "System Not reachable:$computer" 
    }  
 
Hotfixreport > "$env:USERPROFILE\Desktop\Hotfixreport.txt"





References:
https://gallery.technet.microsoft.com/scriptcenter/Generate-a-Report-for-f71a6800
http://stackoverflow.com/questions/24039325/get-the-last-windows-update-install-date-using-powershell

No comments:

Post a Comment