Skip to main content

Step-by-Step Guide: Setting Up Windows Task Scheduler for Google Cloud Directory Sync (GCDS)

Pre-requisites:


Before proceeding, please ensure the following are in place:

  • GCDS is installed on your Windows Server

  • A GCDS configuration file (.xml) has been created and successfully tested

  • Admin credentials are configured within GCDS


Step 1: Locate The Gcds Sync Command:


GCDS uses a command-line tool called sync-cmd, located by default at:

  C:\Program Files\Google Cloud Directory Sync\sync-cmd.exe


The sync command you will use in Task Scheduler is:

  "C:\Program Files\Google Cloud Directory Sync\sync-cmd.exe" -a -c "C:\Path\To\Your\config.xml"


Flag Reference:

  -a  → Applies changes (without this flag, the tool runs in dry-run/test mode only)

  -c  → Specifies the path to your GCDS configuration file


Step 2: Open Task Scheduler


  1. Press Win + R, type taskschd.msc, and press Enter.

OR

  1. Navigate to Start → Administrative Tools → Task Scheduler.


Step 3: Create A New Task


  1. In the right-hand panel, click "Create Task" (use this option, NOT "Create Basic Task", as it provides full configuration control).

  2. The Create Task window will open with multiple tabs.


Step 4: General Tab — Configure Task Identity


  • Name: GCDS Daily Sync

  • Description: Syncs Active Directory users to Google Workspace daily

  • Run as user: Service account or admin with GCDS permissions (click "Change User or Group" to set this)

  • Select: "Run whether user is logged on or not"

  • Check: "Run with highest privileges"

  • Configure for: Your Windows Server version


Step 5: Triggers Tab — Set The Daily Schedule


  1. Click the Triggers tab → Click "New".

  2. Configure the following settings:

  • Begin the task: On a schedule

  • Settings: Daily

  • Start date: Today's date

  • Recur every: 1 day

  • Start time: Your preferred time (recommended: off-peak hours, e.g., 11:00 PM)

  • Enabled: Checked

  1. Click OK.


Note: Scheduling during off-peak hours (late night) is strongly recommended to avoid any impact on users during business hours.


Step 6: Actions Tab — Set The Sync Command


  1. Click the Actions tab → Click "New".

  2. Configure the following:

  • Action: Start a program

  • Program/script: "C:\Program Files\Google Cloud Directory Sync\sync-cmd.exe"

  • Add arguments: -a -c "C:\GCDS\config.xml"

  • Start in (optional): C:\Program Files\Google Cloud Directory Sync\

  1. Click OK.


Step 7: Conditions Tab


  • tart only if computer is on AC power: Uncheck (not applicable for servers)

  • Wake computer to run this task: Check (optional but recommended)

  • Start only if network is available: Check


Step 8: Settings Tab


  • Allow task to run on demand: Checked

  • Run task as soon as possible after a scheduled start is missed: Checked

  • Stop the task if it runs longer than: 1 hour (adjust based on your directory size)

  • If the task is already running: Do not start a new instance


Step 9: Save The Task


  1. Click OK.

  2. Enter the password for the user account configured in the General tab.

  3. Click OK — your task is now saved and scheduled.


Step 10: Test The Task Manually


  1. In the Task Scheduler, locate the GCDS Daily Sync task.

  2. Right-click → Select "Run".

  3. Check the "Last Run Result" column — a value of 0x0 indicates success.

  4. Log in to your Google Admin Console → Directory → Users to verify that users have synced correctly.


Step 11: Enable Logging (Recommended)


To capture sync logs for auditing and troubleshooting, update your action arguments as follows:

  -a -c "C:\GCDS\config.xml" > "C:\GCDS\Logs\sync-log.txt" 2>&1


Alternatively, you can configure GCDS's built-in logging directly within the configuration file.


Verify Sync In Google Admin Console


  1. Go to admin.google.com

  2. Navigate to Directory → Users

  3. Confirm that new or updated Active Directory users appear after the scheduled run.


Common Troubleshooting Reference


  • Task runs but no sync occurs → Remove the -a flag first to run in dry-run/test mode and review the logs. (Important and Check check the logs, accordingly take action)

  • Access denied error → Ensure the run-as account has local admin rights and GCDS permissions.

  • Config file not found → Use the full absolute path and enclose it in quotation marks.

  • OAuth/authentication errors → Re-authorize GCDS credentials and re-save the configuration file.

  • Task does not trigger → Check if the service account password has expired or the account is locked.


Popular posts from this blog

WordPress Site is not loading properly behind Google Cloud/AWS Load Balancer

Hello Guys, Today we are going to understand how can we fix a WordPress loading issue (CSS and JS loading issue) behind the Google Cloud Load Balancer or AWS Load Balancer. Generally, When we host a WordPress site directly with Google Cloud Compute Engine VM instance or AWS EC2 instance. It's loading perfectly fine. But once we added this WordPress server behind any Load Balancer either from GCP Load Balancer or AWS Load Balancer, you site will completely broken, means the CSS and JS of your site not loaded properly. The reason for this is - When you put a load balancer in front of WordPress, you need to modify wp-config.php to process the HTTP header HTTP_X_FORWARDED_PROTO to detect the protocol that the user is using and not the protocol the load balancer is using to connect to your backend. To fix this issue, we have to make following changes in the  wp-config.php  file and add the below code snippet on the top of  wp-config.php file - Google Cloud Platform Load Bal...

How to Setup Kubernetes Cluster in Google Cloud Virtual Machine using "kubeadm"? | Ubuntu 20.04/22.04 LTS

  Hello Friends, In this post, we are going to setup Kubernetes Cluster on Virtual Machine in Google Cloud Platform using kubeadm tool. Hope this post will help you in Kubernetes learning Hand-On Labs (HOL). Requirements: Master Node: No. of VMs 1 Specifications - 2 vCPUs, 4GB RAM, 20 GB HDD (Balanced PD or SSD PD), Operating System (OS) Ubuntu 20.04 LTS x86/64, amd64  Firewall Rule - Ingress Allow 6443 (API Server) | 2379 (ETCD) | 10251 (Scheduler) | 10252 (Controller Manager) 10250 (Kubelet), sudo access with admin access  Worker Node: No. of VMs 2 Specifications - 2 vCPUs, 4GB RAM, 20 GB HDD (Balanced PD or SSD PD), Operating System (OS) Ubuntu 20.04 LTS x86/64, amd64  Firewall Rule - Ingress Allow 30000-32767 (Services) | 10250 (Kubelet),  sudo access with admin access  Disable Swap and comment fstab entry: First, Disable Swap and remove or comment the Swap entries from fstab file : sudo swapoff -a sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab Next...

How to Convert PEM KeyFile into PPK KeyFile and vice versa?

Hi, In this post, we will learn that how can we convert PEM KeyFile into PPK KeyFile and vice versa including the installation of the tool which we will use to accomplish this. For the Windows Operating System In Windows system is easy and straight forward. You just need a tool called "puttygen.exe" from the URL -  https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html Choose the appropriate version as per your OS. Convert PEM into PPK in Windows After downloading the PuTTYgen and open it, load your file (select All Files (*.*) in the bottom dropdown to select your PEM key file).  You will get a message Successfully imported foreign key, Just click OK, Now click on Save private key button to save that key in the location where do you want to save it. Convert PPK into PEM in Windows Now we will convert PPK file into PEM using PuTTYgen in Windows PC Open the PuTTYgen tool, now load your PPK file into it, and finally, Go to Conversions Menu and Click on Export OpenSSH k...