So i have a command that works below individually. I want this to work for a list of hosts. How can i do this?
$vCenter = "VCENTERNAMEHERE" # vCenter FQDN
# Connect to vCenter
Connect-VIServer -Server $vCenter -User "USER" -Password "PASSWORD"
Get-Inventory -Name ESXHOSTNAMEHERE | Scan-Inventory -UpdateType HostPatch
$ESXhost = get-vmhost ESXHOSTNAMEHERE
$compliance = Get-Compliance -Entity $ESXhost -Detailed
$compliance.NotCompliantPatches | Select-Object Name,IDByVendor,Description,@{n='Product';e={$_.product | Select-Object -expandproperty Version}},ReleaseDate |
Export-Csv "C:\FOLDER\vCenterPatchReport.csv" -NoTypeInformation -UseCulture