PowerCLI Reference

New-AlarmAction

Synopsis

This cmdlet creates an alarm action and attaches it to the specified alarm.

Syntax

New-AlarmAction [-AlarmDefinition] <AlarmDefinition> -Email [-Subject <String>] -To <String[]> [-Cc <String[]>] [-Body <String>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

New-AlarmAction [-AlarmDefinition] <AlarmDefinition> -Script -ScriptPath <String> [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

New-AlarmAction [-AlarmDefinition] <AlarmDefinition> -Snmp [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-AlarmAction
Get-AlarmActionTrigger
Get-AlarmDefinition
New-AlarmActionTrigger
Remove-AlarmAction
Remove-AlarmActionTrigger
Set-AlarmDefinition

Detailed Description

This cmdlet creates an alarm action and attaches it to the specified alarm.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
AlarmDefinitionAlarmDefinitionSpecifies the alarm definition for which you want to configure actions.truetrue (ByValue)
BodyStringSpecifies the text of the email message.falsefalse
CcString[]Specifies the email addresses you want to add to the CC field of the email message.falsefalse
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse
EmailSwitchParameterIndicates that when the alarm is activated, the system sends an email message to the specified address. Use the Subject, To, CC, and Body parameters to customize the alarm message.truefalse
ScriptSwitchParameterIndicates that a script is run when the alarm is activated.truefalse
ScriptPathStringSpecifies the path to a batch file, located on a vCenter Server system, that will run when the alarm is activated.truefalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
SnmpSwitchParameterIndicates that a SNMP message is sent when the alarm is activated.truefalse
SubjectStringSpecifies a subject for the email message you want to send.falsefalse
ToString[]Specifies the email address to which you want to send a message.truefalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

The newly created AlarmAction object

Notes

Examples

-------------- Example 1 --------------

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Snmp

Creates an alarm action SNMP.

-------------- Example 2 --------------

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Script -ScriptPath 'c:\test.bat'

Creates an alarm action script.

-------------- Example 3 --------------

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Email -To '[email protected]' -CC @('[email protected]', '[email protected]') -Body 'Test body' -Subject 'Test subject'

Creates an alarm action Email.


Copyright © VMware, Inc. All rights reserved.