vSphere PowerCLI Reference

New-AlarmAction

Synopsis

Creates an alarm action and attaches it to the specified alarm.

Syntax

New-AlarmAction [-AlarmDefinition] <AlarmDefinition> -Script -ScriptPath <String> [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-AlarmAction [-AlarmDefinition] <AlarmDefinition> -Snmp [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-AlarmAction [-AlarmDefinition] <AlarmDefinition> -Email [-Subject <String>] -To <String[]> [-Cc <String[]>] [-Body <String>] [-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

Creates an alarm action and attaches it to the specified alarm.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
AlarmDefinitionAlarmDefinitionSpecify the alarm definition for which you want to configure actions.truetrue (ByValue)
BodyStringSpecify the text of the e-mail message.falsefalse
CcString[]Specify the e-mail addresses you want to add to the CC field of the e-mail 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
EmailSwitchParameterIndicate that when the alarm is activated, the system sends an e-mail message to the specified address. Use the Subject, To, CC, and Body parameters to customize the alarm message.truefalse
ScriptSwitchParameterIndicate that a script is run when the alarm is activated.truefalse
ScriptPathStringSpecify the file path to the script that will run when the alarm is activated.truefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
SnmpSwitchParameterIndicate that a SNMP message is sent when the alarm is activated.truefalse
SubjectStringSpecify a subject for the e-mail message you want to send.falsefalse
ToString[]Specify the e-mail address to which you want to send a message.truefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

AlarmAction

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.ps1'

Creates an alarm action script.

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

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Email -To 'test@vmware.com' -CC @('test1@vmware.com', 'test2@vmware.com') -Body 'Test body' -Subject 'Test subject'

Creates an alarm action Email.


Copyright © 1998 - 2012 VMware, Inc. All rights reserved.