Thread: Quest AD help
View Single Post
Old 09-11-2007   #8 (permalink)
Ian_1


 
 

RE: Quest AD help

What is with "(cn=*Picard)" -- Im not looking for any certian user, but I
tried it both with it and without it for us. I need a list of users in a .CSV
format - firstname, lastname, middle initial, email address.. Thanks

Here's the error I got Bob:
An error occurred while enumerating through a collection: The
(&(objectClass=user)(cn=*picard) search filter is invalid
...
At C:\scripts\Ad_Connection2.ps1:4 char:1
+ $ <<<< searcher.findall() | % {$_.path}




"Bob Landau" wrote:
Quote:

> You are quite correct on both accounts
>
> It is not hard; but I won't say that it's easy unless you are at least some
> what acquainted with the .NET Directory Services classes.
>
> The code I posted did not work I'm not sure why it didn't return an error
> but thats an adventure for another day.
>
> When I cut and pasted my code into the reply I missed the [ADSI] type so the
> constructor never got constructed or should I say the [ADSI] ctor didn't.
> What you got back was a STRING.
>
> Add one very small change
>
> $root = [ADSI] 'LDAP://OU=Enterprise, OU=NextGen DC=Continuum, DC=local'
> $searcher = new-object System.DirectoryServices.DirectorySearcher($root)
> $searcher.filter = "(&(objectClass=user)(cn=*Picard)"
> $searcher.findall() | % {$_.path}
>
> Again you must changes the moniker to reflect your DS namespace.
>
> Here is one other URL which I found using MSN Live it's at the top of the
> list and was one of the pages I used to learn about ADSI
>
> http://www.microsoft.com/technet/tec...l/default.aspx
>
> thx
> bob
>
> "Ian_1" wrote:
>
Quote:

> > Sorry, your script doen't not work. I should not have been specific to just
> > Quest. It can be WMI, or .NET, or utilizing the ADSI accelerator, etc, it
> > really doesn't matter. Since this is the point of scripting to make life
> > simple, surely it's as easy as ? (still researching)
My System SpecsSystem Spec