Previous Topic: Understanding CA ARCserve RHA PowerShell Commands

Next Topic: Resume-Scenario - Resume Replication on a Suspended Replica

Using CA ARCserve RHA PowerShell Commands

This chapter describes in detail how to use CA ARCserve RHA PowerShell commands to control, edit and monitor the Replication and HA processes. The commands are displayed in alphabetical order and they are divided into four groups: Connecting and Registration, Controlling, Editing and Monitoring.

This section contains the following topics:

Connecting and Registration Commands

Controlling Commands

Editing Commands

Monitoring commands

User Management Commands

Connecting and Registration Commands

This section describes how to connect to the Control Service, how to disconnect from it, and how to enter your license key for CA ARCserve RHA registration.

Connect-XO - Connect PowerShell to a Control Service

In order to work with CA ARCserve RHA scenarios using PowerShell, the first thing you need to do is connect to the Control Service that acts as the point-of-control of the CA ARCserve RHA operation. The Connect-XO command enables you to connect PowerShell to a specific Control Service.

Note: Once you finished working with CA ARCserve RHA PowerShell, do not forget to disconnect from the Control Service using the the Disconnect-XO command. Closing PowerShell window will also cause PowerShell to disconnect from the Control Service.

Syntax
Connect-XO [-Host] <String> [-Credentials] <PSCredential> [[-Protocol] [<String>]] [[-Port] [<String>]]
Parameters
Host

The IP address or hostname of the machine where the Control service is running.

Credentials\PSCredentials

The Domain\User Name for the Control Service. These credentials must belong to a user who has Admin rights on the Control Service. After you enter the credentials, a Windows PowerShell Credential Request dialog appears, prompting you to enter your password.

Note: To avoid the need to manually enter your credentials into the PSCredentials dialog, refer to Connect PowerShell to a Control Service using a Script.

Protocol

The protocol that is used for connecting to the Control Service. Enter one of the following: http or https.

Port (optional)

The TCP/IP port that is used for connecting to the Control Service. For http the default value is 8088; For https the default value is 443.

Example: Connect to a Control Service

connect-xo 192.168.1.151 qa88-w3k3\administrator https

Outcome

A Windows PowerShell Credential Request dialog appears, prompting you to enter your password. Then, the following appears:

Connecting...
192.168.1.151 connected!

Connect PowerShell to a Control Service using a Script

You can avoid the need to manually enter your credentials into the PSCredentials dialog by encrypting your password and running it as an object.

To encrypt your password and run it as an object

Enter the following commands, using your password where indicated, and run it once:

read-host -assecurestring | convertfrom-securestring | out-file C:\ securestring.txt <password>
$pass = cat C:\securestring.txt | convertto-securestring
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist <domain\user_name>, $pass
Connect -XO [-Host] <String> $mycred [[-Protocol][<String>]] [[-Port] [<String>]]

The outcome is the same as if you used a standard connection:

Connecting...
<IP Address> connected! 

For more information, refer to the PowerShell documentation or search the internet.

Disconnect-XO - Disconnect from a Running Control Service

After you finished working with CA ARCserve RHA PowerShell, you need to disconnect from the running Control Service. The Disconnect-XO command enables you to disconnect PowerShell from the running Control Service.

Note: Closing the PowerShell window also causes PowerShell to disconnect from the Control Service.

Syntax
Disconnect-XO

Note: This command does not have parameters. It automatically disconnects the running Control Service.

Example: Disconnect from a Control Service

disconnect-xo

Outcome:

192.168.1.151 disconnected!

Get-License - Display your CA ARCserve RHA License

The Get-License command enables you to display your CA ARCserve RHA license details.

Syntax
get-license

Example: Display your CA ARCserve RHA license detailes

get-license

Outcome:

Key: TVC2LF24FTU7G3WJ2QAFMCLGXA5KLPCCYIXTJTWX2MOZFU5GL7EJ3OYZQND7V3G123456
Company:
License expires on: 11  2009
Maintenance till: 11  2009
Number of Assured Recovery nodes:240
Number of CDP Repository nodes:240

Product list:
- Application Server, Windows Cluster edition, 30 instances HA
- File server, Windows Enterprise edition, 130 instances HA
- Application Server, Windows Enterprise edition, 130 instances DR
- File server, Windows Enterprise edition, 30 instances DR
- Application Server, Virtual Machine, 100 instances DR
- Application Server, Virtual Machine, 100 instances HA

Set-License - Register CA ARCserve RHA

The Set-License command enables you to register CA ARCserve RHA using a license key. You need to have a valid registration key before using this command.

Syntax
set-license
Parameters
Key

A valid license key.

Example: Register CA ARCserve RHA using a license key

set-license TVC2LF24FTU7G3WJ2QAFMCLGXA5KLPCCYIXTJTWX2MOZFU5GL7EJ3OYZQND7V3G123456

Outcome:

Key registered successfully
















xo-import-credential

This command reads all credential records in the given XML file and adds them to the connected Control Service, via the command Add-Credential.

Syntax

xo-import-credential

Parameters

Specify the XML file name.

Input

None. No object is piped to xo-import-credential.

xo-convertto-securefile

This command converts a plain text CVS file to a secured XML file.

Syntax

xo-convertto-securefile

Parameters

Source file name and destination are specified.

The source should be a CSV file which has the following format:

hostname,

username,

password

host1,

user1,

pwd1

host2,

user2,

pwd2

Input

None. No object is piped.

xo-credential - Convert a String to a PSCredential Object

The xo-credential command lets you convert a username and password string to a secured credential object, for use within other commands that take PSCredential objects as command arguments.

Syntax

xo-credential <username> <password>

Example

xo-credential johnsmith mypword2

Controlling Commands

This section describes CA ARCserve RHA PowerShell commands that enable you to control the Replication and HA processes.

Diff-Scenario - Generate a Difference Report

The Diff-Scenario command enables you to generate a Difference Report for a given scenario.

Important! We do not recommend initiating a Difference Report when data is being updated on the Master, since all updates that are not yet applied to the Replica will be shown as different.

Syntax
Diff-Scenario [-Name] <String> [-Mode] <String> [-Ignore] <Boolean> 
Parameters
Name

The name of the scenario for which you want to generate the report. You can enter several scenario names by using the Get-Scenario command.

Mode

The synchronization mode. Enter one of the following:

B=Binary

F=File

Ignore

Ignore files of the same name and size during the data comparison. Enter one of the following:

1=Yes

0= No

Note: To view the Difference Report after its generation, open the Report Center from the Overview Page, and select the required report.

Example: Generate a Difference Report

diff-scenario "File Server 1" F 1

Outcome:

Differences report is running for scenario File Server 1...
Done!

Export-Scenario - Export a Scenario to a Specified Location

The Export-Scenario command enables you to export scenarios to other locations in order to reuse them. The scenario is exported as an XMC file, and you can specify its location.

Syntax
Export-Scenario [-Name] <String> [[-File] [<String>]] 
Parameters
Name

The scenario name.

File (optional)

The full path of the exported file. If you do not specify a path, the file is exported to the current directory and carries the name of the scenario with an .xmc extension.

Example: Export a scenario to a specified location

export-scenario "File Server 1" C:\Scenarios

Outcome:

Scenario File Server 1 exported successfully to C:\Scenarios

Expose-Snapshot - Expose a Snapshot

The Expose-Snapshot command enables you to expose a snapshot. You can either expose the snapshot as a local read-only folder by mounting it on an unused folder, or expose it as a local read-only volume by mounting it on an unused drive letter.

Notes:

Syntax
Expose-Snapshot [-Name] <String> [-Index] <Int32> [-Path] <String> [-Port] <String>
Parameters
Name

The name of the host whose snapshot you want to expose.

Index

The index no. of the snapshot, as returned by the Get-Snapshot command.

Path

The path under which you want to expose the snapshot. The path can be either a drive letter or a full folder path.

Port (Optional)

The port that is used for connecting to the given host. The default port is 25000.

Example: Expose a snapshot as a local read-only volume

Expose-Snapshot 192.168.1.153 0 E: 25000

Outcome:

Snapshot {97127d0b-f1c9-4db5-943d-96c39b712fe6} mounted as E:

Import-Scenario - Import a Scenario to the Manager

The Import-Scenario command enables you to import a scenario, in the form of an XMC file, from a specified location. Use this option if you want to relocate scenarios from one Control Service to another, or if you want to use older scenarios that were kept on your system.

Syntax
Import-Scenario [-File] <String> 
Parameters
File

The full path of the imported scenario file.

Notes:

Example: Import a scenario from a specified location to your Manager

import-scenario c:\scenarios

Outcome:

Scenario File Server 2 imported successfully from c:\scenarios

Mount-Snapshot - Mount a Snapshot

The Mount-Snapshot command enables you to mount an exposed snapshot. You can either mount the snapshot as a local read-only folder on an unused folder, or mount it as a local read-only volume on an unused drive letter.

Syntax
Mount-Snapshot [-Name] <String> [[-Index] [<Int32>]] [[-Path] [<String>]] [[-Port] [<String>]]
Parameters
Name

The name of the host whose snapshot you want to mount.

Index

The index number of the snapshot, as returned by the Get-Snapshot command.

Path

The path under which you want to expose the snapshot. The path can be either a drive letter or a full folder path.

Port (Optional)

The port that is used for connecting to the given host. The default port is 25000.

Example: Mount a snapshot as a local read-only volume

mount-snapshot 192.168.1.153 0 F:

Outcome:

Snapshot {745d6ce9-d880-40bf-a0cb-d4f0114bb0f8} mounted as F:

Prepare-Reboot - Prepare a Host for Maintenance

The Prepare-Reboot command enables you to perform maintenance procedures, such as rebooting a host or moving groups between Microsoft Cluster nodes, without performing re-synchronization once these processes are completed.

The hosts that can be prepared for maintenance need to participate in running scenarios. The preparation is done on one host at a time, but this host can participate in multiple scenarios. In these scenarios, the host can function as both the Master and the Replica. When a host participates in a scenario that is not running, the preparation that relates to this scenario does not occur.

After you receive the message informing you that the host is preparing for reboot, you can reboot your host or switch groups between cluster nodes. Once you completed your maintenance procedures, the replication process automatically resumes, without performing re-synchronization.

Note: If after preparing the host for maintenance, you decided not to reboot it and continue running its scenarios, you need to stop the scenarios and re-run them.

Syntax
Prepare-Reboot [-Name] <String>
Parameters
Name

The host name.

Example: Prepare a Replica host for reboot

Prepare-Reboot QA95-W2K3-EX2

Outcome:

Host QA95-W2K3-EX2 Preparing for reboot

Recover-Scenario - Recover Lost Data from the Replica to the Master

The Recover-Scenario command enables you to recover data that was lost on the Master by transferring it from any of the Replica hosts that participate in a scenario. This is done by activating a synchronization process in the reverse direction: from a Replica to the Master. When you activate the Recover-Scenario command, you need to define from which Replica host you want to recover the data, and whether to delete data already on the Master but not on the Replica during the recovery process.

Important! You must stop replication in order to initiate recovery.

To verify that the recovery process is completed, use the Get-Events command. After you get a message informing you that the "Recovery process has finished", you can restart the replication process from the Master to the Replica by using the Run-Scenario command.

Syntax
Recover-Scenario [-Name] <String> [-Host] <String> [-Mode] <String> [-Ignore] <Boolean> [-RemoveMasterFiles] <Boolean> [-RecoveryMode] <String> [-RebootAfterRecovery] <Boolean> 
Parameters
Name

The scenario name.

Host

The Replica host from which you want to recover data.

Mode

The synchronization mode. Enter one of the following:

B=Binary

F=File

Ignore

Ignore files of the same name and size during the data comparison. Enter one of the following:

1=Yes

0= No

RemoveMasterFiles

Whether to delete files that exist only on the Master during the recovery process. Enter one of the following:

1 = Yes, delete files that exist only on the Master

0 = No, keep files that exist only on the Master

RecoveryMode

The data type to recover. Enter one of the following:

A = Application data

S = System State data (only if the System State Protection option is active)

B = Both types of data

The default value is A.

RebootAfterRecovery

Whether to reboot the Master host once the recovery process is completed. Enter one of the following:

1 = Yes, reboot the Master

2 = No, do not reboot the Master

Example: Recover lost data

Recover-Scenario "File Server 1" 192.168.1.153 F 1 0 A 2

Outcome:

Recover application data process started

Resume-IsAliveCheck - Resume IsAlive Checking of a Running Scenario

The Resume-IsAliveCheck command lets you manually resume IsAlive checking for a given running HA scenario.

Syntax
Resume-IsAliveCheck [-ScenarioName] <String>
Parameters
ScenarioName

The target scenario name.

Example: Resume IsAlive checking of SQLscenario

Resume-IsAliveCheck SQLscenario

Outcome:

Resumes periodic is-alive checking of SQLscenario.