Solved

dsget group piped to dsget user gives an error on groups in the group

Posted on 2008-06-17
4
3,087 Views
Last Modified: 2011-04-19
I need to find all usernames and display names in a group.
C:\>dsget group "CN=thegroup,OU=firstfloor,DC=company,DC=com" -members -expand | dsget user -samid -display
It works but if theres a group inside the group i get an error:
"dsget failed:CN=office,OU=groups,OU=department2,DC=server34,DC=company,DC=com:T
he object class of the target does not match the one specified on the command li
ne."

I think i get this error because one of the members in the group is a group..but isnt there any way of only getting the users?
0
Comment
Question by:bergsprekken
4 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
Comment Utility
I don't know of a way to do this using DSGET, though you could append a -c switch to the end to continue in spite of the errors.

You might have to use vbscript, with something like this as a starting point:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0419.mspx
0
 
LVL 31

Expert Comment

by:Henrik Johansson
Comment Utility
The error occurs when "dsget user" is used on group-objects. The -c switch is neaded to continue when error occurs, but the error message will still be displayed if not using 2>nul to throuw away stderr

C:\>dsget group "CN=thegroup,OU=firstfloor,DC=company,DC=com" -members -expand | dsget user -samid -display -c 2>nul


Another solution that can be used when the groups are located in dedicated OUs is to pipe the result through find-command to exclude those lines before using "dsget user".

C:\>dsget group "CN=thegroup,OU=firstfloor,DC=company,DC=com" -members -expand | find /i /v "ou=group" | dsget user -samid -display
0
 
LVL 26

Expert Comment

by:farhankazi
Comment Utility
Try this:

DSQuery * -Filter "(&(objectCategory=Person)(objectClass=User)(memberOf=CN=thegroup,OU=firstfloor,DC=company,DC=com))" -Attr samAccountName displayName

Open in new window

0
 

Expert Comment

by:peterBang
Comment Utility
C:\>dsget group "CN=thegroup,OU=firstfloor,DC=company,DC=com" -members -expand | find /i /v "ou=group" | dsget user -samid -display

It doesn't works, it's displays "FIND: Format incorrect parameter"


0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

I know all systems administrator at some time or another has had to create a script to copy file from a server share to a desktop. Well now there is an easy way to do this in Group Policy. Using Group policy preferences is not hard. The first thing …
Resolve DNS query failed errors for Exchange
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now