Cmdlets > Get-DtJob

Get-DtJob

Returns job information and status for the specified job on the specified server

Syntax

Get-DtJob [-ServiceHost] <Server> [[-JobId] <Guid>] [<CommonParameters>]

Detailed Description

Returns job information and status for the specified job on the specified server. To change the options of an existing job, use Edit-DtJob.

Parameters

Name Type Description Required Pipeline Input
Service
Host
Server

Specify the server object returned from the New-DtServer cmdlet. For this cmdlet, the -ServiceHost should be your target server.

true false
JobId Guid

Specify the job GUID returned from the New-DtJob cmdlet. Specify multiple GUID objects in an array using the format @($JobGuid1, $JobGuid2).

false false

Outputs

JobInfo [ ]

Examples

$DtServerObjectAlpha= New-DtServer -Name alpha -UserName domain\administrator -Password password

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

$DtWorkloadGuid = New-DtWorkload -ServiceHost $DtServerObjectAlpha -WorkloadTypeName FilesAndFolders

$DtWorkload = Get-DtWorkload -ServiceHost $DtServerObjectAlpha -WorkloadId $DtWorkloadGuid

$DtJobOptions = Get-DtRecommendedJobOptions -ServiceHost $DtServerObjectBeta -Source $DtServerObjectAlpha -JobType FilesAndFolders -Workload $DtWorkload

$DtFnFJobGuid = New-DtJob -ServiceHost $DtServerObjectBeta -Source $DtServerObjectAlpha -JobType FilesAndFolders -JobOptions $DtJobOptions.JobOptions

$DtJobInfo = Get-DtJob -ServiceHost $DtServerObjectBeta -JobId $DtFnFJobGuid

Disconnect-DtServer -ServiceHost $DtServerObjectAlpha

Disconnect-DtServer -ServiceHost $DtServerObjectBeta

A server object is created for the server alpha using the domain\administrator and password credentials. It assigns the server object to the variable called DtServerObjectAlpha. 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 script then creates a workload on the server for a files and folders job, returning a global unique ID for the workload, and assigns that ID to the variable DtWorkloadGuid. The workload definition for the workload type and the server is then stored in the DtWorkload variable. The recommended job options for the servers and the workload type are then stored in the variable DtJobOptions. A new files and folders job is created using the servers and the job options. The job ID is stored in the variable DtFnFJobGuid. Finally, the job information for the job is stored in the variable DtJobInfo. The connections for the server object are then closed.

 

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

$DtJobInfo = Get-DtJob -ServiceHost $DtServerObjectBeta

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. All job information for all of the jobs on the server beta are stored in the variable DtJobInfo. This type of usage is common when the jobs were created in the past or if you did not store or do not know a job's ID. 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}

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. This usage is common for servers that have more than one job, but you only want job information for one specific job. The connections for the server object are then closed.