![]() |
The following sample scripts pause and resume a Double-Take job on your target. You will need to modify these scripts to fit your environment and configuration.
Be sure and expand your screen wide enough so that lines in the script file do not wrap.
# Sample script to pause a Double-Take job on your target
# Import the Double-Take PowerShell module # This may be \Service\ or \Console\ depending on your installation import-module "C:\Program Files\Vision Solutions\Double-Take\Console\DoubleTake.PowerShell.dll"
# Create target object $DtTarget = New-DtServer -Name beta -UserName domain\administrator -Password password
# Get the job ID of the job running on the target $DtJobId = Get-DtJob -ServiceHost $DtTarget
# Pause the job running on the target Suspend-DtJob -ServiceHost $DtTarget -JobId $DtJobId.Id
# Close the connections for the server object Disconnect-DtServer -ServiceHost $DtTarget |
# Sample script to resume a Double-Take job on your target
# Import the Double-Take PowerShell module # This may be \Service\ or \Console\ depending on your installation import-module "C:\Program Files\Vision Solutions\Double-Take\Console\DoubleTake.PowerShell.dll"
# Create target object $DtTarget = New-DtServer -Name beta -UserName domain\administrator -Password password
# Get the job ID of the job running on the target $DtJobId = Get-DtJob -ServiceHost $DtTarget
# Resume the job running on the target Resume-DtJob -ServiceHost $DtTarget -JobId $DtJobId.Id
# Close the connections for the server object Disconnect-DtServer -ServiceHost $DtTarget |
If you want to hide your user credentials in your script, use the Windows PowerShell Get-Credential cmdlet. The password will not be visible because Windows stores an encrypted password. See Hiding your password in a PowerShell script for basic details on using this cmdlet. See your Windows PowerShell documentation for detailed instructions.
If you have multiple jobs on your target, you can use the Windows Where-Object cmdlet to identify a specific job by its source or by job name. For example, you might use one of the following.
$DtJobId = $(Get-DtJob -ServiceHost $DtTarget | Where-Object { $_.SourceHostUri.Host -eq “ServerName” }).Id
$DtJobId = $(Get-DtJob -ServiceHost $DtTarget | Where-Object { $_.Options.Name -eq “source to target” }).Id
See your Windows PowerShell documentation for more details on using the Where-Object command.