The following sample script will create a simple full server job for Linux. 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 create a simple full server for Linux job
# Specify the variables to be used in the script
# Source server and credentials # Be sure to include the communication port with the source server $DtSourceName = "112.42.7.63:6325" $DtSourceUserName = "root" $DtSourcePassword = "password"
# Target server and credentials # Be sure to include the communication port with the target server $DtTargetName = "112.42.9.93:6325" $DtTargetUserName = "root" $DtTargetPassword = "password"
# Reserved IP addresses $DtSourceReservedIP = "10.10.10.29" $DtTargetReservedIP = "10.10.10.30"
# Type of workload you will be protecting and type of job you will be creating $DtWorkloadType = "LinuxFullServerFailover" $DtJobType = "LinuxFullServerFailover"
# 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 source and target objects $DtSource = New-DtServer -Name $DtSourceName -UserName $DtSourceUserName -Password $DtSourcePassword $DtTarget = New-DtServer -Name $DtTargetName -UserName $DtTargetUserName -Password $DtTargetPassword
# Create a workload $DtWorkloadGUID = New-DtWorkload -ServiceHost $DtSource -WorkloadTypeName $DtWorkloadType
# Determine what you want to protect # Get the logical items associated with the workload $DtLogicalItems = Get-DtLogicalItem -ServiceHost $DtSource -WorkloadId $DtWorkloadGUID # Add each logical item available on the server, for example, each volume on the server $DtProtectionItem = @() foreach ($item in $DtLogicalItems) { $DtProtectionItem += Set-DtLogicalItemSelection -ServiceHost $DtSource -WorkloadId $DtWorkloadGuid -LogicalPath $item.Path } # Get the workload definition including the workload and logical items $DtWorkload = Get-DtWorkload -ServiceHost $DtSource -WorkloadId $DtWorkloadGUID
# Get the default options that will be used to create the job $DtJobOptions = Get-DtRecommendedJobOptions -ServiceHost $DtTarget -Source $DtSource -JobType $DtJobType -Workload $DtWorkload
# Specify the reserved addresses set earlier to be used in the job options to be used for reverse $DtJobOptions.JobOptions.SystemStateOptions.SourceReservedAddress = $DtSourceReservedIP $DtJobOptions.JobOptions.SystemStateOptions.TargetReservedAddress = $DtTargetReservedIP
# Create the job $DtJobGuidForLFFO = New-DtJob -ServiceHost $DtTarget -Source $DtSource -JobType $DtJobType -Options $DtJobOptions.JobOptions
# Start the job Start-DtJob -ServiceHost $DtTarget -JobId $DtjobGuidForLFFO
# 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.