AD Description Field: Search/Parse

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
new_user
Posts: 157
Joined: Wed May 30, 2007 7:01 am

AD Description Field: Search/Parse

Post by new_user » Fri Feb 15, 2013 6:36 am

I am looking to find an easy repeatable way to search for a date found in the description field for computers. Commonly this date is in between text but is seperated by a ":" in each description field. For example it may be: "Comment:01/25/2013:Comment". I am looking to search for computers with 01/25/2013 in the description field, and next level something like today - 60, whatever date that is see if is in any description fields. Hope someone can help. Thanks.

jvierra
Posts: 14018
Joined: Tue May 22, 2007 9:57 am
Contact:

AD Description Field: Search/Parse

Post by jvierra » Fri Feb 15, 2013 10:14 am

Not an issue. Are you talking about AD description field?

We can retrieve the computer object and then use RegEx to extract the date from the description.

We can also use LDAP filters to match the date.

(description=*1/25/2013*)

This, combined with objectClass can find that string.

User avatar
new_user
Posts: 157
Joined: Wed May 30, 2007 7:01 am

AD Description Field: Search/Parse

Post by new_user » Fri Feb 15, 2013 10:53 am

I can try to use that in my current filter (Yes description field for AD computer object). How could I change that from a hard coded string like the date to something like today - 30 = date to search for in the description field.

jvierra
Posts: 14018
Joined: Tue May 22, 2007 9:57 am
Contact:

AD Description Field: Search/Parse

Post by jvierra » Sat Feb 16, 2013 7:12 am

Use DateDiff to get the date and convert using FormatDateTIme.

Locked