This project pulls users from an Active Directory (AD) group, compares the contents of the group with the users that exist in Fusion and...
  • Inserts new users if they don't already exist in Fusion
  • Updates users details if they already exist in Fusion
  • Disables users in Fusion if they don't exist in the AD group

At our company, we don't use the front-end of Fusion, we only receive tickets via email, phone or walk in, therefore we needed something that pre-populates Fusion with all the employees at our company so that we can log tickets for them.


The script takes quite a while to run (a few minutes in my environment), and because of this you will need to run it from the command line as it will most likely exceed the max-execution-time setting on your PHP installation (read more about the max-execution time setting at http://goo.gl/CM2IA). Running this script from the command line also means it can be placed in a non-publicly-accessible location, and that it can't be used as a vector of attack on your Fusion installation.

I built and have tested this script for Windows, however I don't see a reason why it wouldn't work on a Linux server too, I can only give instructions for Windows however.


Firstly, install the Kayako PHP API Library from its project on Kayako Forge. As opposed to my script, the Kayako API does need to be in a location that is publicly accessible (eg KayakoInstallDir\Custom\KayakoAPI).

You will need to download ADUserSync.php from the files tab of this project, then simply put the ADUserSync.php anywhere on your server (it doesn't need to be in your publicly accessible html directory).

Open ADUserSync.php in your favorite text editor and edit the connection settings at the top. If you are having trouble understanding the LDAP filters and groups etc, please refer to the thread on the Kayako Forums (this one - http://goo.gl/8DUwI).

From the command line, navigate to the location you put ADUserSync.php and then run

php.exe ADUserSync.php

If this doesn't work, please ensure that php.exe is located in the PATH directory of your Windows installation (more about running PHP from the command line at http://goo.gl/mNPl2).

You should see a list of users being inserted, updated and disabled scrolling down the window. Once this succeeds, check your Fusion install and confirm everything worked fine. If so, you can set this up as a scheduled task or cron job. We run ours every morning at 6am to ensure all changes from the previous day are carried across.


Please post up any support queries in the forum link below.

Project Information


Administrator: Dylan Lindgren
Developer: Dylan Lindgren
Author: Dylan Lindgren