Below script can be used to extract the ESXi patch Id from the vCenter Farm
You have to add your input in the list.txt file - the list of ESXi names.
#$vCenter = get-content "E:list.txt"
#Connect-VIServer $vCenter
$report = @()
$ExportFilePath = "E:\DJ\Script\Patchid.csv"
$vmhosts = get-vmhost | sort
foreach($gethost in $vmhosts)
{
$view = $gethost | get-view
$ver = $view.Config.Product.fullname
$result= $gethost.name, $ver | Format-Wide -autosize
$report += $result
}
$report = $report | Export-Csv $ExportFilePath -NoTypeInformation
#Disconnect-VIServer -Confirm:$false
Comments
Post a Comment