CA ARCserve RHA PowerShell is offered to users as an alternative or a supplement to managing the replication process using the CA ARCserve RHA Manager's graphic user interface (GUI). It enlarges and facilities the capabilities of the WS CLI that was provided in previous versions, and it supports both DR and HA operations.
Windows PowerShell™ is a new Windows command-line shell and scripting environment designed especially for system administrators. The shell includes an interactive prompt and a scripting environment that can be used independently or in combination. Unlike most shells, which accept and return text, Windows PowerShell is built on top of the .NET common language runtime (CLR) and the .NET Framework, and accepts and returns .NET objects.
Windows PowerShell™ comes with a large set of built-in commands with a consistent interface. CA ARCserve RHA PowerShell is based on the standard Windows PowerShell™, while adding to it a number of scenario-related-commands, called snap-ins. These snap-ins, which allow you to configure a replication scenario and control and monitor the replication and switchover processes, are described in this Guide. All the scenarios that are managed by CA ARCserve RHA PowerShell commands look and operate exactly as the ones that are managed by the CA ARCserve RHA Manager, and they are automatically saved in the same default location: INSTALL_DIR/ws_scenarios
Windows PowerShell introduces the concept of a cmdlet ("command-let"). A cmdlet is a simple, single-function command-line tool built into the shell, whose aim is to manipulate objects. You can recognize cmdlets by their name format: a verb and noun separated by a dash (-), such as Get-Help, Get-State and Run-Scenario. The verbs express specific actions in Windows PowerShell, while the nouns describe specific types of objects.
In Windows PowerShell, most cmdlets are very simple, and they are designed to be used in combination with other cmdlets. For example, the "get" cmdlets only retrieve data, the "set" cmdlets only establish or change data, the "format" cmdlets only format data, and the "out" cmdlets only direct the output to a specified destination.
PowerShell cmdlets have common parameters, which are not described in this Guide. To get more information about the common parameters, enter:
get-help about_commonparameters
PowerShell cmdlets can have mandatory and optional parameters. If a mandatory parameter is missing, you will be prompted to enter it. If an optional parameter is missing, PowerShell uses the default value.
Windows PowerShell provides a new interactive model that is based on objects, rather than text. One major advantage of using objects is that it makes it much easier to pipeline commands, that is, to pass the output of one command to another command as an input.
The command that receives an object can act directly on its properties and methods without any conversion or manipulation. You can refer to properties and methods of the object by name, rather than calculating the position of the data in the output.
In the following example, the result of a Get-Scenario command is passed to a Get-Hosts command. The pipeline operator (|) sends the result of the command on its left to the command on its right, and the output is sent to a Format-Table command.
PS> Get-Scenario "File Server*" | Get-Hosts | FT -AUTO
Scenario Name Role Parent State IP Port
-------- ---- ---- ------ ----- -- ----
File Server 1 192.168.1.152 Master -- Running 192.168.1.152 25000
File Server 1 192.168.1.153 Replica 192.168.1.152 Running 192.168.1.153 25000
File Server 192.168.1.152 Master -- Stopped 192.168.1.152 25000
File Server 192.168.1.153 Replica 192.168.1.152 Stopped 192.168.1.153 25000
To use CA ARCserve RHA PowerShell, you need to install Windows PowerShell and CA ARCserve RHA snap-ins.
For detailed information about the requirements and installation of Windows PowerShell and CA ARCserve RHA snap-ins, refer to CA ARCserve RHA Installation Guide.
Important! The CA ARCserve RHA PowerShell and the CA ARCserve RHA Control Service to which it is connected must have the same version.
After the installation of Windows PowerShell and CA ARCserve RHA snap-ins, you can run CA ARCserve RHA PowerShell from two places:
Important! When running some commands in PowerShell, a system error occurs if you set different passwords on the Master, Replica and Control Service hosts and some operations may fail to run or complete. Use the same administrator password on all hosts to avoid this issue.
To run CA ARCserve RHA PowerShell from CA ARCserve RHA PowerShell shortcut:
Once you open CA ARCserve RHA PowerShell, the following window is displayed, listing all CA ARCserve RHA PowerShell snap-ins:
Now, you need to connect to the Control Service that manages your CA ARCserve RHA operations. To perform this, use the Connect-XO command.
To run CA ARCserve RHA PowerShell from Windows PowerShell shortcut:
The Windows PowerShell window is displayed.
CD 'INSTALLDIR\Powershell Snapin'
The directory changes.
.\xo.ps1
The CA ARCserve RHA PowerShell snap-ins are installed, and you can start using them to connect to the Control Service that manages your CA ARCserve RHA operations.
There are several ways to get help and additional information in PowerShell:
<command_name> -?
get-command <command_name>
get-help <command_name> -detailed
The detailed view of the command help file includes a description of the command, the command syntax, descriptions of the parameters, and example that demonstrate the use of the command.
<parameter_name>: !?
get-command
get-command | where {$_.DLL -match "XO"} | format-table
alias xo*
get-pssnapin
In Windows PowerShell, there are several commands that enable you to change the output view:
To change the format of the output from any command, use the pipeline operator (|) to send the output of the command to a Format command.
For example, the following command sends the output of a Get-Scenario command to the Format-Table command. As a result, the data is formatted as a table:
PS>get-scenario |Format-table
ID Group Name Type Master State Sync AR
-- ----- ---- ---- ------ ----- ---- --
1123633468 Scenarios File Server 1 FileServer 192.168.1.152 Running File False
1123633497 Scenarios Exchange Server Exchange 192.168.1.152 Running Block True
1123633852 Scenarios File Server 3 FileServer Unknown File False
3848963840 Scenarios File Server FileServer 192.168.1.152 Stopped File False
3848982942 Scenarios File System 1 FileServer QA99-W2K3-EX8 Running File False
For more details, use the following commands to read the help for the Format commands:
get-help format-list
get-help format-table
get-help format-wide
get-help format-custom
Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |