Synchronize using the command line

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

When to synchronize 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 is in order. 

After you’re done making configuration changes, you can automate your synchronization process by 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 run automatic synchronizations. 

Use the command line

GCDS uses the sync-cmd command to run a synchronization. You can use any of the arguments listed below to perform a range of actions such as:

  • Read a specified file.
  • Check that a synchronizations is not already running.
  • Generate a list of changes.
  • Apply any changes.

Tip: You can access information about available arguments by entering sync-cmd -h.

Enter the command on a single line. 

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

Specifies to apply any detected changes. 

Note: If you don't use this tag, a synchronization is run as a test only, and no changes are made to your Google domain. For the best results, run a test synchronization without this argument before running a full synchronization 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 Specifies to not analyze custom schemas. Use this option if you don’t want to synchronize custom schema data for users.
-d,--deletelimits Specifies to ignore any configured delete limits.
-f,--flush

Resolves specific troubleshooting issues.

Improper use can cause performance degradation. Do not use this option unless directed to do so by support.
-g,--groups Specifies to not analyze groups. Use this option if you want to synchronize users, but not groups.
-h,--help Displays help information and exits.
-l,--loglevel value

Specifies to 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

Specifies to not analyze licenses. Use this option if you don’t want to synchronize license data for users.

-o,--oneinstance Restricts the running synchronizations to one instance per configuration file. Only valid with -a.
-ou,--orgunit Specifies to not analyze organizational units.
-r,--report-out Writes reports to a specified output file, in addition to writing them to the log.
-s,--sharedcontacts

Specifies to not analyze shared contacts.

-u,--users Specifies to not analyze users. Use this option if you want to synchronize groups, but not users.
-v Displays short application-version information.
-V Displays detailed application-version information, but does not synchronize it.
Examples

Example 1: Run a simulated synchronization 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 synchromization, including applying 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. See Set your notifications for more information.
Was this article helpful?
How can we improve it?