NAME
Add-DcsAction
SYNOPSIS
Creates an action for the specified task.
SYNTAX
Add-DcsAction -Task <Object> -FilePath <String> -Server <String> -ScriptAction <String> [ -ScriptParams <String> ] [ -AppendTriggerStates <Boolean> ] [ -Connection <String> ] [ -PipelineVariable <String> ]
Add-DcsAction -Task <Object> -LogLevel <String> [ -PostAlert] -Message <String> [ -Connection <String> ] [ -PipelineVariable <String> ]
Add-DcsAction -Task <Object> -Recipient <String> [ -CustomMessage <String> ] [ -Connection <String> ] [ -PipelineVariable <String> ]
Add-DcsAction -Task <Object> -TargetId <String> -MethodActionType <String> [ -Connection <String> ] [ -PipelineVariable <String> ]
DESCRIPTION
Creates an action for the specified task. A parameter set is provided for each of the following function types: a scripting action, a logging action, sending an email, or performing a specific operation on an object (see MethodActionType parameter). One action can be added to the task for each invocation of the cmdlet.
PARAMETERS
- -Task<Object>
- TaskData object, ID, or name of the task to assign the created action to.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: true (ByValue)
- Accept wildcard characters: false
-
- -FilePath<String>
- The complete path to the script file or other executable file to be run as an action. The ScriptAction parameter must also be specified.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -Server<String>
- Computer name or ID of the server. The computer name must be unique or the name must be fully qualified.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -ScriptAction<String>
- Designates the type of scripting function for the action. Possible values are "PowerShell" or "General". See example 2.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -ScriptParams<String>
- Script parameters to be used with the script action. Multiple parameters and the associated values, or parameter arrays can be input, for example "-param1 value1 -param2 value2" or "-paramarray value1, value2, value3". Values without parameter names can also be input, for example "value1, value2, value3". See example 2.
-
- Required: false
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -AppendTriggerStates<Boolean>
- Use this parameter to append the trigger state data for the active triggers in a task. This parameter is only valid when running a script action. The trigger state data is appended to the script and can be accessed from the script, not returned in the TaskActionData object. Specify $true to append the trigger state data in the script. The data returned from the script will depend on the type of triggers that are configured for the task. Data will be returned in an array of objects called "TriggerState". Data from the trigger states can be compared using other cmdlets to obtain additional information. For instance, if the trigger was a monitor trigger, a “MonitorTriggerState” object will be appended with the following fields: MonitoredObjectId, TriggerType, TriggerTime, Caption, and ManualInvocation. The MonitoredObjectId in the object can be used to resolve the exact object that caused the monitor state to trigger the action. Another example, if a checkpoint trigger is configured, the "CheckpointTriggerState object will be appended with the following fields: VirtualDiskId, TriggerType, TriggerTime, Caption, and ManualInvocation. The VirtualDiskID can be used to resolve the exact object that received the checkpoint marker. Data can be output from the script file or used in the script to invoke other cmdlets. See Example 2 for more information.
-
- Required: false
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -Connection<String>
- Alias of the connection to the server group. If not specified, the default connection is used.
-
- Required: false
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -PipelineVariable<String>
-
- Required: false
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -LogLevel<String>
- The type of message to post in the event log if a messaging function is required. Possible values are: "Trace", "Info", "Warning", or "Error".
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -PostAlert<SwitchParameter>
- Specify this parameter to cause the event log message to also post an alert.
-
- Required: false
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -Message<String>
- The message text to post to the event log for a log message action.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -Recipient<String>
- The name of the user to receive the email message. The user must have an email address specified in the user properties (see Add-DcsUser) and mail server information must be set (see Set-DcsSmtpSettings). To send a custom message in the email, use the -CustomMessage parameter in this cmdlet.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -CustomMessage<String>
- The custom message text to include with an email action.
-
- Required: false
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -TargetId<String>
- ID of the target object associated with the MethodActionType parameter. If MethodActionType is "UpdateSnapshot" specify the ID of the snapshot in the TargetId parameter. If MethodActionType is "UpdateSnapshotGroup" specify the ID of the snapshot group in the TargetId parameter. If MethodActionType is "RevertSnapshot" specify the ID of the snapshot in the TargetId parameter. If MethodActionType is "RevertSnapshotGroup" specify the ID of the snapshot group in the TargetId parameter. If MethodActionType is "StartReclamation" specify the ID of the virtual disk in the TargetId parameter. If MethodActionType is "SendCheckpoint" specify the ID of the replication destination virtual disk in the TargetId parameter.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
- -MethodActionType<String>
- Indicates which operation will be performed on the object indicated by the TargetId parameter. Specify one of the following values: "UpdateSnapshot" causes a snapshot to be updated with the latest changes on the source virtual disk. "UpdateSnapshotGroup" causes a snapshot group to be updated with the latest changes on the source virtual disks in the snapshot group. "RevertSnapshot" causes the virtual disk source to be reverted to the current state of the snapshot image. "RevertSnapshotGroup" causes the virtual disk sources in the snapshot group to be reverted to the current state of the snapshot images in the snapshot group. "StartReclamation" causes any SAUs comprised of all zeros on a virtual disk to be de-allocated and returned as available space in the pool. "SendCheckpoint" causes a checkpoint marker to be sent to the replication destination virtual disk.
-
- Required: true
- Position: named
- Default value:
- Accept pipeline input: false
- Accept wildcard characters: false
-
INPUTS
TaskData : Object that identifies the task.
OUTPUTS
TaskActionData : Object that identifies and describes the task action.
NOTES
Also see Remove-DcsAction, Get-DcsAction, Get-DcsTask.
EXAMPLES
Add-DcsAction -Task MyNightlyTask -TargetId (Get-DcsVirtualDisk | where{$_.Caption -eq 'VDisk3'}).Id -MethodActionType StartReclamation
Adds an action for the task named "MyNightlyTask". The action is "StartReclamation" on the virtual disk named "VDisk3". Note the Virtual Disk Id is required, so is obtained programatically using the Get-DcsVirtualDisk cmdlet.
TargetId | : | bc1d2b2d679145698e2029415ea86724 |
MethodType | : | StartReclamation |
TaskId | : | e0b61456-55b1-4f09-9567-39586e71ef16 |
Type | : | InvokeMethod |
Id | : | 29359072-bf3e-4cd2-aab5-18c0056e688b |
Caption | : | Initiates space reclamation on VDisk3 |
ExtendedCaption | : | |
Internal | : | False |
Get-DcsTask -Task Task1 | Add-DcsAction -Server SSV1 -ScriptAction PowerShell -FilePath C:\Test.ps1 -ScriptParams "-param1 Value1 -paramarray ArrayValue1, ArrayValue2, ArrayValue3" -AppendTriggerStates $true
The cmdlet Get-DcsTask is invoked to return the TaskData object for the task named Task1. The object is piped to the cmdlet Add-DcsAction to add a script action for the PowerShell script named "Test.ps1" which resides in the file path "C:\". The script will run with the parameter values "-param1 Value1 -paramarray ArrayValue1, ArrayValue2, ArrayValue3" on the server named "SSV1". The active trigger states for the task are appended to the script.
Import-Module ".\Datacore.Executive.cmdlets.dll"