node-activedirectory icon indicating copy to clipboard operation
node-activedirectory copied to clipboard

Two searches in one ?

Open Cliff-R-K opened this issue 5 years ago • 0 comments

Firstly I must admit that I am completly new to active directory and this is my first attempt trying to collect data using ad.

I managed to get a simple example working:

const config = {
  url: "ldap://<url>",
  baseDN: "OU=Users,OU=Default,DC=<dc>,DC=intra,DC=local",
  username: "<user>",
  password: "<pass>"
};

let sAMAccountName = "test";

let ad = new ActiveDirectory(config);
ad.findUser(sAMAccountName, function(err, user) {
  console.log(JSON.stringify(user.displayName));
});;

But then I need to use the variable user.displayName in another search using another baseDN: baseDN: 'OU=Laptops,OU=LmComputers,DC=<dc>,DC=intra,DC=local'

to be able to get the returned users computer-info. What is the preferred way to do this?

Cliff-R-K avatar Feb 04 '20 11:02 Cliff-R-K