I am opening a new thread to export all alarms whether enable or disable in the Venter. I have taken reference from thread Re: Export All Alarms and definitions from VCenter. but it's not working for me correctly. It's exporting partila number of alarms. I want to export all alarms from vcenter which either enabled or disabled from vcenter. Could you please help me with it.
It's close to working as written. I read back through the whole conversation to get clues, here's where I'm hung up:
WriteError: Line | 68 | $alarmLength = 80 | ~~~~~~~~~~~~~~~~~ | Cannot overwrite variable alarmLength because it is read-only or constant.
I get that error, not sure what to do about it.
But the main issue is one that SteJeh references in his post, "- the copied alarms in root will be named in "alarm name (moved to dc1, dc2, dc3, dc4, dc5 ... )"; how to change your great script to rename the original name one time?"
So I'll run the script to move the alarm Test1 from DC1 to DC2, and the alarm will stay in DC1 but the name will be changed to "Test1 (moved to DC2). They said they fixed it by deleting the alarm from the target DC (if I'm reading it correctly), but it doesn't even exist in the target DC so I'm not sure where to go from here.
Thanks in advance!
Restarted the session and you're right, didn't get that alert. But it's still doing the thing where it doesn't move it, it just renames it. Here's the only error it throws and some screenshots:
MethodInvocationException: Line | 62 | $alarmMgr.CreateAlarm($destination.ExtensionData.MoRef,$newAlarm) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "CreateAlarm" with "2" argument(s): "The object 'vim.Datacenter:datacenter-3' has already been deleted or has not been completely created"
Let me know if you have any thoughts
The object 'vim.Datacenter:datacenter-3' has already been deleted or has not been completely created
seems to say that the value in $destination is not correct though.
Do a stop/start of your PS session.
Check you have only 1 vCenter connection open.