Foreach ($esx in $esxhosts) {
Get-VIEvent -Entity (Get-VMHost $esx).Entity -Start (Get-Date).AddHours(-1) -Finish (Get-Date) `
| Where {$_.GetType().Name -eq "EventEx"} `
| Select @{N="Time";E={$_.CreatedTime.ToUniversalTime()}}, @{N="Message";E={$_.FullFormattedMessage}} `
| Export-Csv c:\$esx.csv -UseCulture -NoTypeInformation
}
I have 3 hosts in $esxhosts but the result are all the same. Is this a known bug? or something is wrong with my command? or it is the expected behavior?
My PowerCLI version is latest but my Esx Hosts are version 4.1
Anyone encountered this?