Scripting examples > Other sample scripts > Pausing and resuming your target

Pausing and resuming your target

The following sample scripts pause and resume your Double-Take target. (The server itself is not paused. Only Double-Take processing is paused.) 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 the Double-Take target

 

# Specify the variables to be used in the script

 

     # Target server and credentials

     $DtTargetName = "beta"

     $DtTargetUserName = "domain\administrator"

     $DtTargetPassword = "password"

 

# 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 $DtTargetName -UserName $DtTargetUserName -Password $DtTargetPassword

 

# Pause all of the Double-Take jobs on the target

Suspend-DtTarget -ServiceHost $DtTarget -All

 

# Close the connections for the server object

Disconnect-DtServer -ServiceHost $DtTarget

 

# Sample script to resume the Double-Take target

 

# Specify the variables to be used in the script

 

     # Target server and credentials

     $DtTargetName = "beta"

     $DtTargetUserName = "domain\administrator"

     $DtTargetPassword = "password"

 

# 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 $DtTargetName -UserName $DtTargetUserName -Password $DtTargetPassword

 

# Resume all of the Double-Take jobs on the target

Resume-DtTarget -ServiceHost $DtTarget -All

 

# 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.