Hi,
I want to disable all alarm actions for a vm while I have to disable FT to clone a vm. My script are ready for cloning but I can´t find any solution to disable alarm actions for a vm via PowerCLI. Anybody knows a solution for PowerCLI 5.1R1?
Thanks,
Michael
The -Entity parameter requires a PowerCLI inventory object as value and does not accept names. You can try it like this:
Get-AlarmActionState -Entity (Get-VM -Name VMTEST1) -Recurse:$false
Did you look at the Set-AlarmDefinition cmdlet with the -Enabled:$false parameter ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Well, I know this cmdlet. But if I understand it right the cmdlet let me disable one alarm, not all of them for a vm, isn´t it?
True, that is for the alarm itself.
For a specific VM have a look at my Alarm actions – enable – disable – report post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I´ve found your great website a few days ago and gave your script a try but it doesn´t work. I´ve leave you a message with the error message in comments. But anyway: now I´ve updated PowerCLI to 5.1R2 and after executing your script I get the following output:
PowerCLI C:\scripts> Get-AlarmActionState -Entity VMTEST1 -Recurse:$false
Get-AlarmActionState : Die Argumenttransformation für den Parameter "Entity" kann nicht verarbeitet werden. Der Wert "VMTEST1" vom Typ "System.String" kann nicht in den Typ "VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl" konvertiert werden.
Bei Zeile:1 Zeichen:29
+ Get-AlarmActionState -Entity <<<< VMTEST1 -Recurse:$false
+ CategoryInfo : InvalidData: (:) [Get-AlarmActionState], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-AlarmActionState
Sorry for the german output - I can´t got an english output. Oh and: It´s Windows Powershell 2.0.
The -Entity parameter requires a PowerCLI inventory object as value and does not accept names. You can try it like this:
Get-AlarmActionState -Entity (Get-VM -Name VMTEST1) -Recurse:$false
Sorry, I'm a bit behind in answering all the comments :smileygrin:
Try running it like this (the function doesn't do Object By Name I'm afraid).
Get-AlarmActionState -Entity (Get-VM VMTEST1) -Recurse:$false
or
Get-VM VMTEST1 | Get-AlarmActionState -Recurse:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks a lot - I´m not very familar with the syntax and the differences. Now it works like a charm