Synchronize using the command line

Google Cloud Directory Sync

Google Cloud Directory Sync (GCDS) uses sync-cmd to run synchronizations from the command line.

When to sync from the command line

When you set up or modify your configuration, you should first perform a manual synchronization from Configuration Manager. This allows you to check the synchronized data and make sure it's in order.

After you’re done making configuration changes, you can automate your sync process using the command line. You can incorporate synchronizations into any scheduling or batch script you wish to use. Alternatively, you can use a third-party tool to schedule automatic synchronizations.

Use the command line

Use the sync-cmd command to run a sync. Run the command from the GCDS installation directory and enter the command on a single line.

You can use the command arguments listed below to perform a range of actions such as:

  • Apply any detected changes.
  • Read a specified file.
  • Set the logging detail level.

Tip: You can get information about the available command arguments by entering sync-cmd -h.

Command arguments and examples

sync-cmd command arguments
Argument Description
-a,--apply

Apply any detected changes.

Note: If you don't use this tag, a sync is run as a test only, and no changes are made to your Google domain. For the best results, run a test sync without this argument before running a full sync with it.

-c,--config file-name

Specifies the XML configuration file to load.

Important: Synchronization won't occur without a valid XML file specified with this argument.

-cs, --customschemas

Do not analyze custom schemas.

Use this option if you don’t want to sync custom schema data for users.

-d,--deletelimits Ignore any configured delete limits.
-f,--flush

Clears the cached copy of your Google Account data before running the sync.

Important: Improper use can cause performance degradation. Do not use this option unless directed to do so by Google Cloud support.

-g,--groups

Do not analyze groups.

Use this option if you want to sync users, but not groups.

-h,--help Displays help information and exits.
-l,--loglevel value

Override the default or configured log level with a specified value. Valid values (in increasing order of detail) are FATAL, ERROR, WARN, INFO, DEBUG, and TRACE.

In most cases, the recommended log level is INFO.

-lic,--license

Do not analyze licenses.

Use this option if you don’t want to sync license data for users.

-o,--oneinstance

Restricts any running synchronizations to a single instance per XML configuration file. This prevents multiple instances from running inadvertently (for example, through a scheduler or cron job).

Important: Only valid with -a.

-ou,--orgunit Do not analyze organizational units.
-r,--report-out Writes reports to a specified output file, in addition to the log.
-s,--sharedcontacts Do not analyze shared contacts.
-u,--users

Do not analyze users.

Use this option if you want to sync groups, but not users.

-v Displays short application-version information.
-V Displays detailed application-version information, but does not sync it.
Examples

Example 1: Run a simulated sync using the XML configuration file C:\Users\user\gds-config.xml:

sync-cmd -c C:\Users\user\gds-config.xml

Example 2: Run a full sync, including applying any detected changes, using the XML configuration file C:\Users\user\gds-config.xml:

sync-cmd -a -c C:\Users\user\gds-config.xml

Next steps

You should monitor all synchronizations by checking for any notification messages on a regular basis. For details, see Set your notifications.
Was this helpful?
How can we improve it?