VMware Cloud Community
M_K1
Contributor
Contributor
Jump to solution

"Disable alarm actions" for a vm

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

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

Did you look at the Set-AlarmDefinition cmdlet with the -Enabled:$false parameter ?


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

0 Kudos
M_K1
Contributor
Contributor
Jump to solution

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?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

M_K1
Contributor
Contributor
Jump to solution

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.

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

M_K1
Contributor
Contributor
Jump to solution

Thanks a lot - I´m not very familar with the syntax and the differences. Now it works like a charm Smiley Happy

0 Kudos