Queues tasks
Syntax
Invoke-DtQueueTask [-ServiceHost] <Server> [-JobId] <Guid> [-OnQueue <TaskParameters>] [-OnTransmit <TaskParameters>] [-OnReceive <TaskParameters>] [-OnExecute <TaskParameters>] [-InteractWithDesktop] [-Timeout <TimeSpan>] [-ConnectionId <Guid>] [<CommonParameters>]
Invoke-DtQueueTask [-ServiceHost] <Server> [-OnQueue <TaskParameters>] [-OnTransmit <TaskParameters>] [-OnReceive <TaskParameters>] [-OnExecute <TaskParameters>] [-InteractWithDesktop] [-Timeout <TimeSpan>] [-ConnectionId <Guid>] -JobInfo <JobInfo> [<CommonParameters>]
Detailed Description
This cmdlet queues tasks inline with replication data. Keep the following in mind when using this cmdlet.
Parameters
Name | Type | Description | Required | Pipeline Input |
---|---|---|---|---|
Service Host |
Server |
|
true | false |
JobId | Guid |
|
true | false |
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. |
false | 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. |
false | 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. |
false | 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. |
false | false |
Interact With Desktop |
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. |
false | 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. |
false | false |
Connection Id |
ConnectionId |
|
false | false |
JobInfo | JobInfo |
|
true | true |
Outputs
Examples
$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 |
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.