I'm working on a script to acknowledge alarms but I'm running into an error. My production environment is vCenter Appliance 6.7 Update 3l.
I've converted all the variables to literals and run the commands from the PS command line to help me isolate the problem. Can anyone see the root cause of the error below given the two commands I've run?
PS H:\> (Get-VM -Name **redacted**).ExtensionData.TriggeredAlarmState.Key
alarm-7.vm-76683
PS H:\> (Get-View AlarmManager).AcknowledgeAlarm('Alarm-alarm-7', 'VirtualMachine-vm-76683')
Exception calling "AcknowledgeAlarm" with "2" argument(s): "The object 'vim.VirtualMachine:vm-76683' has already been deleted
or has not been completely created"
At line:1 char:1
+ (Get-View AlarmManager).AcknowledgeAlarm('Alarm-alarm-7', 'VirtualMac ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : VimException