The Double-Take PowerShell cmdlets require a server object, and that server object requires user credentials for the specified server. Many corporate security policies do not allow for user passwords to be typed in plain text, which can make scripting difficult. You can use the credential object returned from the Windows PowerShell Get-Credential cmdlet. This password will not be visible because Windows stores an encrypted password. The following sample script logs in to a Double-Take server using a hidden password. See your Windows PowerShell documentation for more details on creating a credential object with Get-Credential. 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 login to a Double-Take server using a hidden password
# Specify the variables to be used in the script
# Source server $DtSourceName = "alpha"
# Target server $DtTargetName = "beta"
# 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"
# Store user credentials in an encrypted form $DtCredentialEncrypted = Get-Credential domain\administrator
# At this point, you will be prompted to supply the password # and the credentials will be stored in an encrypted format
# Create source and target objects $DtSource = New-DtServer -Name $DtSourceName -Credential $DtCredentialEncrypted $DtTarget = New-DtServer -Name $DtTargetName -Credential $DtCredentialEncrypted
# If you are incorporating this script into another script, # be sure and close the connections for the server objects # at the end of the script using the Disconnect-DtServer # cmdlet. For example, # Disconnect-DtServer -ServiceHost $DtSource # Disconnect-DtServer -ServiceHost $DtTarget |