Click or drag to resize
Invoke-DtQueueTask

This cmdlet queues tasks inline with replication data. Keep the following in mind when using this cmdlet.

For this cmdlet, the -ServiceHost should be your target server.

Any combination of one or more execution points can be used with the same Invoke-DtQueueTask cmdlet.

All script processing messages, including errors, can be viewed in the Double-Take log and the Windows Event log.

If your source is in a restore required state (after a failover), any task placed on the queue will be executed immediately. Use caution when submitting tasks while in this state so that the target does not get inadvertently updated.

If a task is submitted after replication is stopped, the task will be executed immediately.

A task may be discarded if all jobs to a target are manually stopped, if replication is stopped to a target, or if an auto-disconnect occurs.

If you disable task command processing while tasks are in queue, those tasks will not be executed.

The user submitting the task command must be a member of the Double-Take Admin security group on both the source and target and the Double-Take service must have proper privileges to access the files or run the commands specified in the task.

Syntax

Invoke-DtQueueTask [-JobId] <Guid> [-OnQueue] <TaskParameters> [-OnTransmit] <TaskParameters> [-OnReceive] <TaskParameters> [-OnExecute] <TaskParameters> [-InteractWithDesktop] <SwitchParameter> [-Timeout] <TimeSpan> [-ConnectionId] <Guid> [-ServiceHost] <Server> [<CommonParameters>]

Invoke-DtQueueTask [-JobInfo] <JobInfo> [-OnQueue] <TaskParameters> [-OnTransmit] <TaskParameters> [-OnReceive] <TaskParameters> [-OnExecute] <TaskParameters> [-InteractWithDesktop] <SwitchParameter> [-Timeout] <TimeSpan> [-ConnectionId] <Guid> [-ServiceHost] <Server> [<CommonParameters>]

Parameters
-OnQueue<TaskParameters>

Execute the specified task on the source machine as soon as the source receives and queues the task. During heavy replication, there may be a delay while the task is queued inline with the replication operations. Define the task parameters by using New-DtTaskParameters.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnTransmit<TaskParameters>

Execute the specified task on the source machine just before the source transmits the task to the target. Define the task parameters by using New-DtTaskParameters.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnReceive<TaskParameters>

Execute the specified task on the target machine as soon as the target receives and queues the task. Define the task parameters by using New-DtTaskParameters.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnExecute<TaskParameters>

Execute the specified task on the target when the target processes the task from the queue. Since the task is not executed until it is processed, if the target is paused, the task will be held in queue. Define the task parameters by using New-DtTaskParameters.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InteractWithDesktop<SwitchParameter>

Tasks interact with the desktop and, therefore, display on screen and run in the foreground. If you do not use this option, tasks do not interact with the desktop and will be run in the background.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Timeout<TimeSpan>

Specify the length of time, in timespan format, to wait for tasks to complete. For example, 0.01:30:00 would wait for one hour and thirty minutes. If you set the timespan to zero (0.00:00:00), there is no timeout delay and the next operation is immediately processed. If you do not specify a timeout parameter, the timeout will default to forever.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ConnectionId<Guid>

Specify the connection ID returned from the Get-DtConnectionIds cmdlet.

Required?

false

Position?

named

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobId<Guid>

Specify the job GUID returned from the New-DtJob cmdlet or the Id within the job information returned from the Get-DtJob cmdlet.

Required?

true

Position?

2

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobInfo<JobInfo>

Specify the job information returned from the Get-DtJob cmdlet. The job information can be piped from the Get-DtJob cmdlet.

Required?

true

Position?

named

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ServiceHost<Server>

Specify the server object returned from the New-DtServer cmdlet.

Required?

true

Position?

1

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters.

Examples

------------------EXAMPLE------------------

A server object is created for the server beta using the domain\administrator and password credentials. It assigns the server object to the variable called DtServerObjectBeta. The job(s) are retrieved from DtServerObjectBeta, but only the job information where the source machine name is equivalent to the name stored in the variable DtServerObjectAlpha is retrieved. That information is then stored in the variable DtJobForAlpha. The script called ScriptName, located in C:\PathDir, along with two arguments, is stored in the variable DtScript. The script to launch PowerShell and run the script called Script.ps1, located in C:\PathDir, along with two arguments and the ExecutionPolicy parameter, is stored in the variable DtPsScript. Finally, the script stored in DtScript is executed when the target receives and queues the task and the script stored in DtPsScript is executed when the target processes the task from the queue. The connections for the server object are then closed.

$DtServerObjectBeta = New-DtServer -Name beta -UserName domain\administrator -Password password

$DtJobForAlpha = Get-DtJob -ServiceHost $DtServerObjectBeta | Where-Object {$_.Statistics.CoreConnectionDetails.SourceMachineName -eq $DtServerObjectAlpha}

$DtScript = New-DtTaskParameters -ScriptPath "C:\PathDir\ScriptName" -Arguments "arg1 arg2"

$DtPsScript = New-DtTaskParameters -ScriptPath "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Arguments "-File ""C:\PathDir\Script.ps1"" ""-Arg1 argument1_info -Arg2 argument2_info"" -ExecutionPolicy RemoteSigned"

Invoke-DtQueueTask -ServiceHost $DtServerObjectBeta -JobId $DtJobForAlpha.Id -OnReceive $DtScript -OnExecute $DtPsScript

Disconnect-DtServer -ServiceHost $DtServerObjectBeta