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

NetwareX Extender

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

nwSearchFilter Issue


Question:

I need to collect all groups with a name starting with 'PV_*'
TreeSpec = '\\IV_TREE'
nwSearchFilter(TreeSpec,'BASECLS','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','Group',0,0,0)
nwSearchFilter(TreeSpec,'AND','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','????',0,0,0)
nwSearchFilter(TreeSpec,'EQ','',0,0,0)
nwSearchFilter(TreeSpec,'AVAL','PV_*',0,0,0)
nwSearchFilter(TreeSpec,'END','',0,0,0)
I can't figure out what I should fill in at the question-marks...

Answer:

You pretty much answered the question yourself when you stated your question.

You want to get all objects with a base class value of "Group" and with names [hint, hint, nudge, nudge, wink, wink] that begin with "PV_*". The ANAME token is asking for an attribute name, and you're needing the use the naming attribute for a group object.

The $64,000 answer is... "CN".

The CN [Common Name] attribute is the single most commonly used attribute in eDirectory as it is the primary naming attribute for nearly every object in the tree, excepting L [Locality], C [Country] and a few others that have unusual naming attributes other than CN.

User Reply:

well the attribute name is recognized, no errors, but also no results !

TreeSpec = '\\IV_TREE' nwSearchFilter(TreeSpec,'BASECLS','',0,0,0) nwSearchFilter(TreeSpec,'ANAME','Group',0,0,0) nwSearchFilter(TreeSpec,'END','',0,0,0)

gives a list of groups, also groups starting with 'PV_'

but:

TreeSpec = '\\IV_TREE'
nwSearchFilter(TreeSpec,'BASECLS','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','Group',0,0,0)
nwSearchFilter(TreeSpec,'AND','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','CN',0,0,0)
nwSearchFilter(TreeSpec,'EQ','',0,0,0)
nwSearchFilter(TreeSpec,'AVAL','PV*',0,0,0)
nwSearchFilter(TreeSpec,'END','',0,0,0)
gives no results.

i also tried 'Common Name', no errors, no results....

Answer:

It should definitely be "CN". You're basically using the same code that is provided in the example for nwSearchFilter(), and I actually ran that code to test it.

What does your call to nwSearchObjects() look like? Maybe you're not recursively searching sub-containers in the tree and thus are failing to find the objects. Another possibility is that you don't have sufficient rights to find the objects. Can you locate them & view them using something like ConsoleOne while you're logged in to eDir as the same user that is running this script?

User Reply:

Without:
nwSearchFilter(TreeSpec,'AND','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','CN',0,0,0)
nwSearchFilter(TreeSpec,'EQ','',0,0,0)
nwSearchFilter(TreeSpec,'AVAL','PV*',0,0,0)
I find all the groups so i think i have enough rights (?)

and i use:

nwSearchObjects('[Root]','','',2,'')
to find the groups. Is that right ?

Answer:

Your call to nwSearchObjects() looks correct.

I think I lead you down the wrong path with performing a comparison of the value of the CN attribute. The object naming attributes are handled *differently* from how other attributes are handled when performing a filtered search. Give this a try instead and see how it works out.

TreeSpec = '\\IV_TREE'

nwSearchFilter(TreeSpec,'BASECLS','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','Group',0,0,0)
nwSearchFilter(TreeSpec,'AND','',0,0,0)
nwSearchFilter(TreeSpec,'RDN','',0,0,0)
nwSearchFilter(TreeSpec,'ANAME','PV_*',0,0,0)
nwSearchFilter(TreeSpec,'END','',0,0,0)

nwSearchObjects('[Root]','','',2,'')

Article ID:   W16545
File Created: 2005:02:18:12:21:22
Last Updated: 2005:02:18:12:21:22