Also, you can use ADO to query AD for objects where either an attribute has
a value, or where the attribute is missing. For example:
(&(sAMAccountName=JimSmith)(employeeID=*))
will only return a record if user JimSmith has a value assigned to
employeeID. Otherwise, no records are returned. Or:
(&(sAMAccountName=JimSmith)(!employeeID=*))
will only return a record if user JimSmith does not have a value assigned to
the employeeID attribute. The RecordCount property of the Recordset object
can be used to check whether 0 or 1 record was retrieved. And, these queries
can be used in ADUC to filter objects in the display. You could filter for
all users that do not have a value assigned to employeeID with:
(&(objectCategory=person)(objectClass=user)(!employeeID=*))
For more on using ADO to search AD, see this link:
http://www.rlmueller.net/ADOSearchTips.htm
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Post by J. Anoschecking for empty strings is perfectly possible. do it all the time.
howzabout posting the code that is failing?
Post by CraigHi, is there a way to check if an attribute of a user object in Active
Directory is "Not Set", i.e. currently has no values set?
Checking for Null or an empty string doesn't seem to be possible, but I
don't really want to rely on checking for an error.
many thanks,
Craig