First off, you need to have the Update Manager cmdlets installed to be able to use the Get-Compliance cmdlet in the code.
The following script will go over each host, and output the severity, patch ID, release date, additional info (a link to the kb article) and a short update to what the patch is for.
It will look something like this:
HostSecurity,ESX410-201204402-SG,"4/26/2012 10:00:00 AM","For more
information, see http://kb.vmware.com/kb/2014988.","Updates libxml2"
Now for the code itself:
ForEach ($HostToCheck in Get-VMHost){
$Details = Get-Compliance $HostToCheck -Detailed| Select -ExpandProperty NotCompliantPatches| Select @{N="Hostname";E={$HostToCheck}}, Severity, IdByVendor, ReleaseDate, Description, Name
$ComplianceResult += $Details
}
$ComplianceResult | Export-CSV -Path c:\NeededPatches.CSV -NoType
No comments:
Post a Comment