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.
This topic is 11 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
new_user
Posts: 157
Last visit: Tue May 06, 2014 5:46 pm

AD Description Field: Search/Parse

Post by new_user »

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

AD Description Field: Search/Parse

Post by jvierra »

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
Last visit: Tue May 06, 2014 5:46 pm

AD Description Field: Search/Parse

Post by new_user »

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

AD Description Field: Search/Parse

Post by jvierra »

Use DateDiff to get the date and convert using FormatDateTIme.
This topic is 11 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked