Compare CLI

OmniCompare CLI enables comparisons to be performed via the command-line interface enabling integrations with 3rd party applications such as software deployment software, SQL Server Agent or custom scripts. The information required to complete the comparison and the necessary credentials to access the servers are stored within the .afd export file; therefore Aireforge Studio will be required to perform any future changes in terms of new servers or comparisons.

Exporting a Comparison File

OmniCompare CLI is a lightweight application; therefore, the comparison file must be created using the main Aireforge Studio application and exported. This exported file contains the servers to check, authentication credentials and the comparisons to perform.

To create the .adc file, select the command line icon at the top right of the comparisons section. You are then prompted to enter a secure password and the location of the saved file.

We will save this file to d:\tf.adc.

Aireforge Compare CLI Window

Selecting servers to check and comparisons to run

OmniCompare CLI Commands

The OmniCompare CLI executable resides in the Aireforge Studio program folder. The argument for the application will be logged out if none are passed in, or the help argument (-h) is used.

omnicomparecli.exe -h

Aireforge Compare CLI Window

omnicomparecli.exe -h

Performing a CLI Comparison

To perform a trace flag comparison against the servers detailed above, we pass in the comparison file and password. For this tutorial we will enable full logging, although this should be used for debugging only as a lot of information is logged; especially during full comparisons of large estates.

    omnicomparecli.exe -i d:\tf.adc -p <password> -v full

As no differences are found, the error code returned is 0.

Aireforge Compare CLI Window

Handling Differences

We will now enable trace flag 1117 on the SQL2014 instance to demonstrate how the application changes. OmniCompare CLI has highlighted the change and returned an error code of 1. This error code could be caught, and an alert raised or a deployment aborted.

Aireforge Compare CLI Window

Unsuccessful OmniCompare comparison with error code 1

Reviewing Differences

The information detailed above could be logged to file using the -o command, although a more straightforward option would be to run the comparison via the Aireforge Studio application.

Aireforge Compare CLI Window