Link to home
Start Free TrialLog in
Avatar of ccdc12
ccdc12

asked on

help with dsquery and dsget

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

Avatar of ccdc12
ccdc12

ASKER

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
Avatar of ccdc12

ASKER

can a wild * be used?
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ccdc12

ASKER

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


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