You could do something like this
Get-Inventory -PipelineVariable item |
ForEach-Object -Process {
$item.ExtensionData.TriggeredAlarmState |
ForEach-Object -Process {
$alarm = Get-View -Id $_.Alarm
New-Object -TypeName PSObject -Property ([ordered]@{
Name = $item.Name
Type = ($item.GetType()).Name -replace 'Impl',''
Alarm = $alarm.Info.Name
Time = $_.Time
Staus = $_.OverallStatus
})
}
}
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
------------------------------
Original Message:
Sent: Nov 26, 2024 01:21 PM
From: satheeshsatz
Subject: Active Alerts Triggered in the vCenter
I am trying to get the currently triggered alerts in my vcenter server for vm, esxi, datastore or any alerts there in my vcenter.
Have tried multiple options but its not helping.