Ok, so I hacked this together. However, I cannot find how to get the information about if the alarm has been acknowledged or not..
Add-PSSnapin VMWare.VimAutomation.Core
Connect-VIServer "vcenter01"
$outputPath = "C:\data"
Get-VIEvent -Start (Get-Date).AddDays(-7) -MaxSamples ([int]::MaxValue) |
Where {$_ -is [VMware.Vim.AlarmStatusChangedEvent] -and ($_.To -eq "Yellow" -or $_.To -eq "Red") -and $_.To -ne "Gray"} |
Select CreatedTime,FullFormattedMessage,@{N="Entity";E={$_.Entity.Name}},@{N="Host";E={$_.Host.Name}},@{N="Vm";E={$_.Vm.Name}},@{N="Datacenter";E={$_.Datacenter.Name}} |
Export-Csv "$outputPath\alarms.csv" -noTypeInformation -Delimiter ";"