Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Quest AD help

Reply
 
Old 09-11-2007   #11 (permalink)
voodooking


 
 

RE: Quest AD help

or more simply if using quest ad snapins

Get-QADUser | where {$_.memberof -match "Desired Group Name"} | fl
givenname,sn,DisplayName,mail

"Ian_1" wrote:
Quote:

> 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
Old 09-11-2007   #12 (permalink)
voodooking


 
 

RE: Quest AD help

Get-QADUser | where {$_.CanonicalName -match "Desired Group Name"} | fl
Quote:

> givenname,sn,DisplayName,mail
sorry memberof probably won't do it

"voodooking" wrote:
Quote:

> or more simply if using quest ad snapins
>
> Get-QADUser | where {$_.CanonicalName -match "Desired Group Name"} | fl
> givenname,sn,DisplayName,mail
>
> "Ian_1" wrote:
>
Quote:

> > 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:
> > >
> > > > 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
Old 09-11-2007   #13 (permalink)
Bob Landau


 
 

RE: Quest AD help

I'm a SciFi addict I can't help it. Hear is how you read the Moniker

DC Continuum (a reference to the Q Continuum: my favorite sub-series)
DC Local (required for me since I don't have a Internet DNS name)
OU Enterprise (a reference to Star Trek Enterprise)
OU NextGen (my favorite verion of Enterprise; the original was too much of a
Western for me)

As I mentioned you need to change the LDAP namespace to reflect the DS in
your organization.

In regards to the Filter I simply wanted to show to specify a compound
filter the syntax is a little different than most people are used to the
logical operator must be first.

All the filter did was return _only_ Captain Jean-Luc Picard. While you can
filter on the client side also it's much more effiecient for the machine that
contains the AD to filter the data for you.

In your case since you're not looking for a particular individual use

"(objectClass=User)"

All I've given you is a start. There is more work that you'll need to do I
suggest by looking at both

$searcher.findall()[0] | get-member
$searcher.findall()[0].Properties | get-member.


"Ian_1" wrote:
Quote:

> 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
Old 09-11-2007   #14 (permalink)
Ian_1


 
 

RE: Quest AD help



"Bob Landau" wrote:
Quote:

> I'm a SciFi addict I can't help it. Hear is how you read the Moniker
>
> DC Continuum (a reference to the Q Continuum: my favorite sub-series)
> DC Local (required for me since I don't have a Internet DNS name)
> OU Enterprise (a reference to Star Trek Enterprise)
> OU NextGen (my favorite verion of Enterprise; the original was too much of a
> Western for me)
>
> As I mentioned you need to change the LDAP namespace to reflect the DS in
> your organization.
>
> In regards to the Filter I simply wanted to show to specify a compound
> filter the syntax is a little different than most people are used to the
> logical operator must be first.
>
> All the filter did was return _only_ Captain Jean-Luc Picard. While you can
> filter on the client side also it's much more effiecient for the machine that
> contains the AD to filter the data for you.
>
> In your case since you're not looking for a particular individual use
>
> "(objectClass=User)"
>
> All I've given you is a start. There is more work that you'll need to do I
> suggest by looking at both
>
> $searcher.findall()[0] | get-member
> $searcher.findall()[0].Properties | get-member.
>
>
> "Ian_1" wrote:
>
Quote:

> > 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:
> > >
> > > > 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
Old 09-11-2007   #15 (permalink)
Ian_1


 
 

Solved!

Ok, something about perspiration is the mother of all.. anyway-- here is the
code I finally was able to use to resolve my issue.

I used Quest AD cmdlet PS to finally get my list:

get-qadgroupmember Accountants | format-table DisplayName,Initials,EMAIL >
C:\Accountants.txt

Individual attributes can be attained and then formatted like above from:
Get-QADUser “Bruce Payette” | Format-List

Thank goodness thats over but what fun learning so I can't complain. Thanks
to all those who tried to help. It's Miller time!
My System SpecsSystem Spec
Old 09-11-2007   #16 (permalink)
voodooking


 
 

RE: Quest AD help

simple one liner
Get-QADUser | where {$_.CanonicalName -match "Desired Group Name"} | fl
givenname,sn,DisplayName,mail

if cononical name does not suite your needs run
Get-QADUser "logonname for a known user in given group" | fl * | more

and scan for appropriate property containing group name
possibly ParentContainer and substitue $_.ParentContainer for
$_.CanonicalName

using -match instead of -eq allows you to use the least complex unique form
so
for group a group Systems Ifrastructure under group Systems you could use
-match "Systems Inf"

i assume you can figure out the csv output
i am assuming you can figure out the output to csv

My System SpecsSystem Spec
Old 09-11-2007   #17 (permalink)
Ian_1


 
 

RE: Quest AD help

Voodoo, your on a whole other level, none of your stuff works or makes sence
to me. "CanonicalName" - lol ok.
My System SpecsSystem Spec
Old 09-14-2007   #18 (permalink)
phyler


 
 

RE: Quest AD help

Not sure if you ever found what you were looking for but I got this to work:

Get-QADGroupMember "GroupName" | ft givenname,sn,displayname,mail

Just subsitute whatever group you want in for GroupName.

Example:

Get-QADGroupMember "accountants" | ft givenname,sn,displayname,mail

Hope that helps.

phyler
www.nbwheeling.org/~aball




"Ian_1" wrote:
Quote:

> Looking for the Quest PS code to query a group in AD
> (LDAP://cn=accountants,ou=city,ou=com) and pull first name, last name,
> display, and email address. Im looking while this is posted, just any help
> while Im under a deadline would be greatly appreciated. Thank!
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Quest powershell v 1.2 PowerShell
How to i add Quest snappins ? PowerShell
Quest AD cmdlets RC1 PowerShell
Can't add Quest AD cmdlets PowerShell
Quest PMC Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46