VMware Cloud Community
tekhie
Contributor
Contributor

Error running script to generate alarm information

hi everyone

i am running the attached script that pulls out the default event triggers for alarms in vcentre 4.1. for some reason it is breaking at line 10 with the following error message ..

Cannot index into a null array.

At :line:10 char:39

+ if ($alview.Info.Expression.Expression[ <<<< 0].gettype().Name -eq "EventAlarmExpression")

is anyone able to assist ?

thanks in advance

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

If there is only 1 expression, the Expression property will not be an array and hence you can not index it.

Btw, you can get all the alarms by doing

$alarmMgr.GetAlarm($null)

Alarms are not necessarily defined on the rootfolder.

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
tekhie
Contributor
Contributor

hi luc

thanks for the response - dont follow though ... tried changing the $alarmmgr value but still errors out

tks

Reply
0 Kudos