![]() |
The following sample script will gather and set several Double-Take job and server options. You may want to consider running cmdlets like this from the PowerShell command line, rather than a script, so you can see the values returned from the get cmdlets and then make appropriate adjustments for your set cmdlets. You will need to modify this script 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 gather and set Double-Take job and server options # You may want to run these cmdlets from the PowerShell command prompt # so that you can see the values returned for each of the get cmdlets # and then determine appropriate desired values for each option
# 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"
# Login to a server by creating source and target objects $DtSource = New-DtServer -Name alpha -UserName domain\administrator -Password password $DtTarget = New-DtServer -Name beta -UserName domain\administrator -Password password
# Gather and display several job and server settings $DtMaxChecksumBlocksSource = Get-DtOption -ServiceHost $DtSource -Name MaxChecksumBlocks $DtMaxChecksumBlocksTarget = Get-DtOption -ServiceHost $DtTarget -Name MaxChecksumBlocks $DtMirrorChunkSizeSource = Get-DtOption -ServiceHost $DtSource -Name MirrorChunkSize $DtMirrorChunkSizeTarget = Get-DtOption -ServiceHost $DtTarget -Name MirrorChunkSize $DtCalculateByVolumeSource = Get-DtOption -ServiceHost $DtSource -Name CalculateByVolume $DtCalculateByVolumeTarget = Get-DtOption -ServiceHost $DtTarget -Name CalculateByVolume $DtAutoRemirrorSource = Get-DtOption -ServiceHost $DtSource -Name AutoRemirror $DtAutoRemirrorTarget = Get-DtOption -ServiceHost $DtTarget -Name AutoRemirror write-output "==================" write-output "These are the current options and values." write-output "The source is displayed first, and the target is displayed second." $DtMaxChecksumBlocksSource $DtMaxChecksumBlocksTarget $DtMirrorChunkSizeSource $DtMirrorChunkSizeTarget $DtCalculateByVolumeSource $DtCalculateByVolumeTarget $DtAutoRemirrorSource $DtAutoRemirrorTarget
# Store the desired value for each job and server setting $DtMaxChecksumBlocksDesiredValue = @{MaxChecksumBlocks=64} $DtMirrorChunkSizeDesiredValue = @{MirrorChunkSize=131072} $DtCalculateByVolumeDesiredValue = @{CalculateByVolume=1} $DtAutoRemirrorDesiredValue = @{AutoRemirror=1}
# Set the new values Set-DtOption -ServiceHost $DtSource -Setting $DtMaxChecksumBlocksDesiredValue Set-DtOption -ServiceHost $DtTarget -Setting $DtMaxChecksumBlocksDesiredValue Set-DtOption -ServiceHost $DtSource -Setting $DtMirrorChunkSizeDesiredValue Set-DtOption -ServiceHost $DtTarget -Setting $DtMirrorChunkSizeDesiredValue Set-DtOption -ServiceHost $DtSource -Setting $DtCalculateByVolumeDesiredValue Set-DtOption -ServiceHost $DtTarget -Setting $DtCalculateByVolumeDesiredValue Set-DtOption -ServiceHost $DtSource -Setting $DtAutoRemirrorDesiredValue Set-DtOption -ServiceHost $DtTarget -Setting $DtAutoRemirrorDesiredValue
# Regather and display the updated values $DtMaxChecksumBlocksSource = Get-DtOption -ServiceHost $DtSource -Name MaxChecksumBlocks $DtMaxChecksumBlocksTarget = Get-DtOption -ServiceHost $DtTarget -Name MaxChecksumBlocks $DtMirrorChunkSizeSource = Get-DtOption -ServiceHost $DtSource -Name MirrorChunkSize $DtMirrorChunkSizeTarget = Get-DtOption -ServiceHost $DtTarget -Name MirrorChunkSize $DtCalculateByVolumeSource = Get-DtOption -ServiceHost $DtSource -Name CalculateByVolume $DtCalculateByVolumeTarget = Get-DtOption -ServiceHost $DtTarget -Name CalculateByVolume $DtAutoRemirrorSource = Get-DtOption -ServiceHost $DtSource -Name AutoRemirror $DtAutoRemirrorTarget = Get-DtOption -ServiceHost $DtTarget -Name AutoRemirror write-output " " write-output "==================" write-output "These are the updated options and values." write-output "The source is displayed first, and the target is displayed second." $DtMaxChecksumBlocksSource $DtMaxChecksumBlocksTarget $DtMirrorChunkSizeSource $DtMirrorChunkSizeTarget $DtCalculateByVolumeSource $DtCalculateByVolumeTarget $DtAutoRemirrorSource $DtAutoRemirrorTarget
# Close the connections for the server objects Disconnect-DtServer -ServiceHost $DtSource 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.