We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

help with dsquery and dsget

Medium Priority
5,405 Views
Last Modified: 2012-06-27
I need help with the dsguery and dsget command.
I have an OU = Distro
inside of the OU there there is a Group scope that is = Universal
The group type is =  Distribution
The group name is = ACL Team
This group has users object and contact object as the memebers of this distribution group.

I need information from this distribution group.
I need from the users in this group thier email address
I need from the contact object the email address

could you help me with this command and out put the result to a file.
I am missing the part how to get the information from the contacts in this distribution group

also let me know about the spaces in between the commands
Thanks
dsquery group -name "ACL Team" | dsget group -members | dsget user -email -display > c:\Group\ACL.txt

Open in new window

Comment
Watch Question

Author

Commented:
when I run the command I get the error
dsget fail: CN= Name of Contact, OU=Glenwood,DC=com: The object clas of the target not match the one specified on the command line.
type line.
type dsget /? for help. Email
user@mail.com

When the distribution group has a contact object in with the user object I  get this error.
If the distribution group only has user object I don't get an error

I think it is because I do not have the command to handle the contact object .

Thank

Author

Commented:
can a wild * be used?
PowerShell Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:

I see your choices as this:

1. Use "DSQuery *" to return membership using an LDAP filter returning only specific object classes. e.g.

dsquery * -Filter "(&(objectClass=user)(objectCategory=person)(memberOf=CN=ACL Team,OU=somewhere,DC=yourdomain,DC=com))"

Then pipe that into "dsget user".

2. Upgrade to something more capable / more flexible.

If you go for upgrading I would suggest you get this:

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

Then this:

http://www.quest.com/powershell/activeroles-server.aspx

Both of those are free. Then all you need to do is run this in the shell that it installs:

Get-QADGroupMember "ACL Team" | Select-Object Name,Email

Chris

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Speshalyst Tech Support professional
CERTIFIED EXPERT

Commented:

Author

Commented:
I installed the powershell but I could not get the command posted above.
instead of trying to get the powershell command to work...

I am in a time crunch....

could you please provide the command that will work the quickest and easyest..

I have several groups to get who is the memeber and the emails and the contact email in each group

thanks

Chris DentPowerShell Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:

PowerShell is quickest and easiest for me to explain :)

Either run the version of PowerShell from the Quest Software folder in the Start Menu, or run this first:

Get-PSSnapIn -Reg | Add-PSSnapin -ea 0

It's likely that you're running the version without the additional commands added (because I didn't say you needed to do otherwise). Once you have those loaded the command should execute.

You can have it export directly to a CSV file by tacking Export-CSV onto the end:

Get-QADGroupMember "ACL Team" | Select-Object Name,Email | Export-CSV -Path "C:\Group\ACL.txt"

Otherwise you will need to construct queries like this for each group:

dsquery * -Filter "(&(objectClass=user)(objectCategory=person)(memberOf=CN=ACL Team,OU=somewhere,DC=yourdomain,DC=com))"  | dsget user -email -display > c:\Group\UsersACL.txt

dsquery * -Filter "(&(objectClass=contact)(objectCategory=person)(memberOf=CN=ACL Team,OU=somewhere,DC=yourdomain,DC=com))"  | dsget contact -email -display > c:\Group\ContactsACL.txt

Chris
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.