![]() |
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.
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>]
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
false |
Position? |
named |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
true |
Position? |
2 |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Required? |
true |
Position? |
named |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
Required? |
true |
Position? |
1 |
Accept Pipeline Input? |
true (ByPropertyName) |
Accept Wildcard Characters? |
false |
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters. |
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