Created
January 11, 2016 20:55
-
-
Save michaeltlombardi/f17229c6acaa0e79d86f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$TargetComputers = Import-Csv c:\ADcomputers.csv | Select-Object -ExpandProperty Name | |
ForEach($Target in $TargetComputers){ | |
If (Test-Connection -ComputerName $Target -Count 1){ | |
Get-Hotfix -ComputerName $Target | | |
Sort-Object -Property InstalledOn -Descending | | |
Select-Object -First 1 -Property InstalledOn,PSComputerName | | |
Export-Csv -Path C:\patchstatus.csv -Append | |
} Else { | |
Write-Error "Unable to connect to $Target" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment