Skip to content

Instantly share code, notes, and snippets.

@prodehghan
Created March 18, 2020 16:03
Show Gist options
  • Save prodehghan/65d8093c9c7db93edf6922ea6f76b64d to your computer and use it in GitHub Desktop.
Save prodehghan/65d8093c9c7db93edf6922ea6f76b64d to your computer and use it in GitHub Desktop.
A sample node script for searching in Active Directory users, using "activedirectory2" package
var ActiveDirectory = require('activedirectory2');
var config = { url: 'ldap://sgdc.SYSTEMGROUP.NET',
baseDN: 'dc=systemgroup,dc=net',
username: 'mohammadhd@systemgroup.net',
password: 'your_password' }
var ad = new ActiveDirectory(config);
var query = 'sAMAccountName=MohammadHD';
ad.find(query, function(err, result) {
console.log(err);
console.log(result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment