Hello!! I'm hoping someone can assist me with a PowerCLI script that can pull the subject info into a csv file.
Thanks
Naveen Kumar
LucD
ARomeo
You could do something like this, provided you are connected to all the vCenters.
ForEach-Object -Process {
$vc = $_
$si = Get-View ServiceInstance -Server $vc
$alarmMgr = Get-View -Id $si.Content.AlarmManager -Server $vc
Get-Inventory -Server $vc | ForEach-Object {
$alarmMgr.GetAlarmState($_.ExtensionData.MoRef) |
Where-Object { [VMware.Vim.ManagedEntityStatus]::yellow, [VMware.Vim.ManagedEntityStatus]::red -contains $_.OverallStatus } |
Select-Object @{N = 'Alarm'; E = { (Get-View -Id $_.Alarm).Info.Name } },
OverallStatus,
Time,
@{N = 'Entity'; E = { (Get-View -Id $_.Entity).Name } },
@{N = 'vCenter'; E = { $vc.Name } }
}
} |
Export-Csv -Path .\alarm-report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference