Loading...

Command Line Interface - Restore - Active Directory iDataAgent

Table of Contents

Generate the Command Line Script from the CommCell Console

Perform the Restore

Restore Using a Map File

Find Data

Generate the Command Line Script from the CommCell Console

In order to run the restores from command line, you need an input xml file which contains the parameter values for configuring the restore options. This input xml file can be obtained by generating the script from the CommCell Console and saving it on the computer from where the restore will be performed.

Follow the steps given below to generate a script which you can use to perform a restore from the command line interface:

  1. From the CommCell Browser, navigate to Client Computers | <Client> | Active Directory | <Backup Set>.
  2. Right-click the <Subclient> in the right pane and then click Browse Backup Data.
  3. Click OK.
  4. In the right pane of the Browse window, select the data that you want to restore and click Recover All Selected.
  5. Select the required restore options which you want to execute using the script.
  6. Click Save as Script.
  7. Enter the location to save the script along with the file name and extension. For example, "C:\scripts\myscript.bat" on Windows and "/usr/scripts/myscript.sh" on UNIX. Alternatively, you can also click Browse and navigate to the location.

    The script will be saved as a .xml file and .bat/.sh file.

    If a file with the same name already exists in the specified location, both the .xml and .bat/.sh files will be overwritten.

  8. Enter the username and password for the user account which you want to use to perform the restore.

    By default, the user account which you have used to login to CommCell console is used for performing the restore. However, if the user account does not have access to application and database, click Use a different account.

  9. Click OK.

Perform the Restore

  1. From Command prompt, navigate to <Software_Installation_Directory>/Base and run the following command:

    qlogin -cs <commserve name> -u <user name>

  2. Navigate to the location where the .xml file is saved and execute the saved .xml script using the qoperation execute command.

    qoperation execute -af restore.xml -appName 'Active Directory' -clientName xxxxx -backupsetName xxxxx -destPath 'xxxxx' -sourceItem 'xxxxx'

    Note: If the sourceItem parameter contains a directory path, verify the path is valid before you run the command.

  3. Verify the status of the job using the following command:

    qlist job -j jobID

  4. Once the job completes, log off from the CommServe using the qlogout command.

    qlogout [-cs <commserve_host_name>] [-all] [-tf <tokenfile>] [-tk <token>] [-h]

Examples

Restoring from a Current Backup

qoperation execute -af restore.xml -appName 'Active Directory' -clientName client1 -backupsetName backupset1 -destPath '/dest1' -sourceItem '/source1'

Restoring Files to a Point-in-Time (Date)

qoperation execute -af restore.xml -appName 'Active Directory' -clientName client1 -backupsetName backupset1 -destPath '/dest1' -sourceItem '/source1' -toTimeValue 2011-11-28

Restoring Files to a Point-in-Time (Date and Time)

qoperation execute -af restore.xml -appName 'Active Directory' -clientName client1 -backupsetName backupset1 -destPath '/dest1' -sourceItem '/source1' -toTimeValue '2011-11-28 15:40:00'

Restore Using a Map File

Preparing the Command Line Interface

  1. Open Windows Powershell.
  2. Set the path or directory to the base folder (Software Installation Directory/ Base folder).
  3. Type the following command to install and register the cmdlet:

    set-alias installutil C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe
    installutil CvADCmdlet.dll

  4. Double-click the ADPOWERSHELL.psc1 console file that resides in the base folder (Software Installation Directory/ Base folder). The Command Window opens from where the Browse and Restore operations are performed.

    Note that after you enter the first command in the Command Window, you will be prompted to provide the CommCell Console credentials.

Create a Map File

A map file is a text file that resides on the client computer and contains the Active Directory paths of the data to be restored. Each path must be a separate line in the map file.

Examples of map file content

  • To restore an individual user, type:

    CN=Fred Jones,OU=Users,DC=MyDomain,DC=Company,DC=com

  • To restore a computer group, type:

    CN=Computers,DC=MyDomain,DC=Company,DC=com

  • To restore an individual computer, type:

    CN=MyComputer,CN=Computers,DC=MyDomain,DC=Company,DC=com

  • To restore an Organizational Unit, type:

    OU=Development,OU=Engineering,DC=MyDomain,DC=Company,DC=com

Invoke the Browse Operation

Parameters

-a

appname ("Active Directory")

-b

BackupSet

-c

Client name as it appears in the CommServe

-sc

Subclient Name

-path

Type a path within quotes

Syntax

The following command performs a browse operation of the files listed in the given "path" and lists the files.

Invoke-Browse -a "appname" -b "BackupSet" -c "Client" -sc "subclientName" - path "path"

If you want to change the values for a particular parameter, type:

Invoke-Browse <type_changed_parameter>

For example, to change the backupset where the browse operation needs to be performed, type:

Invoke-Browse -b "BackupSet1"

Any values that are not changed are assumed to be the same as given in the previous command.

Invoke the Restore Operation

Parameters

-a

appname*

-b

BackupSet*

-c

Client name as it appears in the CommServe*

-sc

Subclient Name*

-totime

To time range**

-fromtime

From time range**

-mp

Map file path**

* indicates that the parameters are mandatory for the first time you type the command.

** indicates that the parameters are optional.

Syntax

The following command performs a restore operation of the files listed in the given "path".

Invoke-Restore -a "appname" -b "Backupset" -c "Client" -sc "subclientName" -mp "c:\mapfile.txt"

or to restore the files that reside in a given path, type:

"path"| Invoke-Restore -a "appname" -b "BackupSet" -c "Client" sc "SubclientName"

When you run the command for the first time, you must enter all mandatory values like appName, backupsetName, clientName, and subclient name. Once the values are provided, you do not have to provide all the mandatory values when you run the command again unless there is a change in the value.

You must provide either a map file or a given path using a pipe when you run the command.

Examples

  • Browse all files under Users for the domain given in the path.

    Invoke-Browse -a "Active Directory" -b defaultBackupSet -c TestAD -sc default -path "CN=Users,DC=mydomain,DC=com"

  • Restore all files from a given map file.

    Invoke-Restore -a "Active Directory" -b "BackupSet" -c "Client" -sc "SubclientName"-mp "C:\mapfile.txt"

  • Restore all files in a given path.

    "OU=Accounting,DC=mydomain,DC=com"| Invoke-Restore -a "Active Directory" -b "BackupSet" -c "Client" sc "SubclientName"

Find Data

The following command is available for finding backed up data.

qlist backupfiles

Description

This command performs a search operation on backed up files and saves the results to a file. The type of operation is defined in the opType attribute in the XML request file:

  • Find: Performs a recursive search and returns a list of files and folders. Specify recursion by using asterisks in the path attribute as shown: <paths path="C:\data\**\*" />.
  • Browse: Performs a search on one directory and returns a list of files and folders in that directory. (The Browse operation is not recursive.)
  • Versions: Lists all of the versions of a single file.

For the Find and Browse operations, you can limit the results to backed up files for a specific job by using the <jobId> element in the XML request file.

In case of an error, an error code and description are displayed as: "backupfiles: Error errorcode: errordescription"

Usage

qlist backupfiles -af <path_to_input_XML_file> -dpath <path_to_output_XML_file> [-tf <tokenfile>] [-tk <token>] [-example] [-h]

Options

-af

XML file that contains the request

-dpath

Destination path and file name for the XML output file

-tf

Reads token from a file

-tk

Token string

-example

Sample "find" and "browse" XML requests

-h

Displays help

Diagnostics

Possible exit status values are:

0 - Successful completion.

1 - CLI usage failures, due to the use of an unsupported option or missing argument.

2 - Any other failure. 

Examples

  • For the default subclient, finds all of the files and folders in the C:\data directory and its subdirectories.

    qlist backupfiles -af c:\searches\find.xml -dpath c:\results\find_results.xml

    XML example for the Find operation:

    <databrowse_BrowseRequest opType="Find">
      <entity _type_="0" appName="Windows File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
      <paging pageSize="4294967295" skipNode="0"/>
      <mode mode="2"/>
      <paths path="C:\data\**\*" />
    </databrowse_BrowseRequest>

  • For the default subclient, browses the files and folders in the C:\ directory.

    qlist backupfiles -af c:\searches\browse.xml -dpath c:\results\browse_results.xml

    XML example for the Browse operation:

    <databrowse_BrowseRequest opType="Browse">
      <entity _type_="0"appName="Windows File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
      <mode mode="2"/>
      <paging pageSize="4294967295" skipNode="0"/>
      <paths path="C:\"/>
      <timeRange fromTime="0" toTime="1331280338"/>
    </databrowse_BrowseRequest>

  • For job ID 857 run on the default subclient, browses the files and folders in the C:\ directory.

    qlist backupfiles -af c:\searches\find.xml -dpath c:\results\find_results.xml

    XML example for the Browse operation for a specific job ID:

    <databrowse_BrowseRequest opType="Browse">
      <entity _type_="0"appName="Windows File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
      <mode mode="2"/>
      <paging pageSize="4294967295" skipNode="0"/>
      <paths path="C:\"/>
      <timeRange fromTime="0" toTime="1331280338"/>
      <advOptions>
        <advConfig>
          <browseAdvancedConfigBrowseByJob>
            <jobId>857</jobId>
          </browseAdvancedConfigBrowseByJob>
        </advConfig>
      </advOptions>
    </databrowse_BrowseRequest>

  • For the default subclient, lists the versions available for the mydata.txt file.

    qlist backupfiles -af c:\searches\versions.xml -dpath c:\results\versions_results.xml

    XML example for the Versions operation:

    <databrowse_BrowseRequest opType="Versions">
      <entity _type_="0"appName="Windows File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
      <mode mode="2"/>
      <paths path="C:\Users\Administrator\Documents\test\mydata.txt"/>
    </databrowse_BrowseRequest>

Last modified: 8/6/2018 9:33:41 PM