LDAP OU Definition filtering - how to only get Active Directory users updated within the past 2 weeks.

Rick Forristall
Tera Guru

I need to know my users status from Active Directory so inside ServiceNow I can set their active field appropriately.

Someone in a local SN Dev meetup suggested that I do a full pull once of all AD users, then pull only those updated in the last 2 weeks as my scheduled pulls.

Has anyone done something like this and what was the Filter you used in the LDAP OU Defnition's Filter field?

Thanks,


Rick Forristall
Goodwill of Central and Northern Arizona

2 REPLIES 2

Rick Forristall
Tera Guru

Here's a suggestion I got from Zechariah Harvey on the ServiceNow Slack channel.

1. Create a new LDAP OU Definition

2. Create a scheduled job that calculates the date 2 weeks ago

3. Update the LDAP OU Definition's Filter field in the scheduled job.

4. Run the scheduled import after that.

 

Sounds like a nifty approach - I'm researching and will try to post my results here.

Rick Forristall
Tera Guru

I was able to get this to work and it's a pretty nifty solution to getting only the active directory users whose records have changed "X" days in the past - in my case I'm getting those that changed with the past 3 days.

I posted a blog article so I could share the information across multiple platforms. Feel free to read about my process and the code I used to generate the dynamic ldap query string for the LDAP OU definition's filter field.

 

http://www.sn-101.com/synch-active-directory-users-status-with-servicenow-users-with-efficiency-and-...

 

#ldap #activedirectory