VMware Cloud Community
billyjoel
Enthusiast
Enthusiast

get user that modofied alarm?

Hi all,

Is there a way in powercli to see who modified a vcenter alarm? I mean who did the last change.

I did some googling but could not find anything.

Thanks.

3 Replies
LucD
Leadership
Leadership

You could do something like this.

You want to change the $start value, depending on how far you want to look back.

$alarmName = 'Test1'

$alarm = Get-AlarmDefinition -Name $alarmName

$start = (Get-Date).addHours(-1)

Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) |

where{$_ -is [VMware.Vim.AlarmReconfiguredEvent] -and $_.Alarm.Alarm -eq $alarm.Id} |

Select @{N='Name';E={$_.Alarm.Name}},

    @{N='Date';E={$_.CreatedTime}},

    @{N='User';E={$_.UserName}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

billyjoel
Enthusiast
Enthusiast

Hi LucD

It did not retrieve anything but I found this older post and I got the result of what I was looking for with "@{N='Last Modified By';E={$alarm.ExtensionData.Info.LastModifiedUser}},"

Re: Export All Alarms and definitions from VCenter.

Thanks Smiley Happy

0 Kudos
LucD
Leadership
Leadership

That might indicate that you don't keep events for long enough on your vCenter to capture those changes.

But yes, that is another method to find the last user that changed an alarm.

If you want to see all users, you have to rely on the events.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference