LDAP OU Definition filtering - how to only get Active Directory users updated within the past 2 weeks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2018 06:58 AM
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
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2018 09:07 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 05:57 AM
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.
#ldap #activedirectory