WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

dsFindPath with NULL Criteria


Question:

I'm trying to search AD to find all users who have a logon script that is not null and does not equal our production or test logon scripts. I cannot seem to figure out how to specify the concept of scriptPath!='' in the search filter parameter. Here's a sample of what I've tried. It is still returning objects that have null scriptPath properties.
Ret = dsFindPath("LDAP://domain.com/DC=domain,DC=com","(& (objectCategory=Person) (!(scriptPath='')) (!(scriptPath=prod.bat)) (!(scriptPath=test.bat)) )")

Answer:

Perhaps the problem is that the scriptPath property is not set, so it isn't exactly null, but rather non-existant...?

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/search_filter_syntax.asp

The above refernce explains that you don't actually search for "not null" but rather "is something". So, the following search filter works correctly:

"(& (objectCategory=Person) (!(objectClass=contact)) (scriptPath=*) )"

Article ID:   W16796
File Created: 2007:07:03:14:26:18
Last Updated: 2007:07:03:14:26:18