LDAP Successfull but not all users created

LDAP Successfull but not all users created

by Vijay Shrinivas -
Number of replies: 5

I was able to successfully configure ldap and our users are now able to login into moodle using their AD.


however, I am able to see only the users who have logged in under the Site Administration --> Users--> Browse List of user


1. Is there a way where I can upload all users in the LDAP into moodle in one go. So that I can create cohorts and enrol users for course sin bulk/

2. or Should I have to wait for every user to login at least once before I enrol them ( please ignore my ignorance)


Ideally, I would like to have all the users into moodle from LDAP so that I can create cohorts and assign courses to them, before they log into moodle for the first time.


any help or suggestion much appreciated.

Average of ratings: -
In reply to Vijay Shrinivas

Re: LDAP Successfull but not all users created

by John Okely -

This can be done by running the sync users script:

php auth/ldap/cli/sync_users.php

This will become more user friendly when 3.0 is released

In reply to John Okely

Re: LDAP Successfull but not all users created

by Vijay Shrinivas -

Thank you. 

I am newbie, can you tell me how to run the script on windows server. I tried running it on powershell using admin right, But am getting an error.

Would appreciate if you can tell me steps. Sorry to bother you

Thanks in advance.


In reply to Vijay Shrinivas

Re: LDAP Successfull but not all users created

by John Okely -

Sure, what error are you getting?

In reply to Vijay Shrinivas

Re: LDAP Successfull but not all users created

by Sam Stevens -

If you are on windows then that command won't work

You need to make your own variant of

[full path to php install]\php.exe -f "[full path to moodle diectory]\auth\ldap\cli\sync_users.php"

which can then be scheduled as a task for every night or whenever you want to pull new users across.

So if PHP is installed in c:\php and moodle in c:\moodle then the command would be 

c:\php\php.exe -f "c:\moodle\auth\ldap\cli\sync_users.php"


Average of ratings: Useful (1)