• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2324
  • Last Modified:

csvde output users NOT members of a given group

Hello,

I see that I can use CSVDE to output a list of users in a group. I need to generate a list of all users that are NOT a member of a particular group. I am trying to ID all user accounts in my domain that are not current. I made a current user group and added all my current users. Now I want to generate a list into txt/csv that lists all other user object that are not a member of my current users group.

Thanks!
0
JFTech
Asked:
JFTech
  • 6
  • 4
1 Solution
 
Mike KlineCommented:
I have a blog post about using tools like adfind to do this

http://adisfun.blogspot.com/2009/06/find-users-who-are-not-in-specific.html

You can use that same LDAP query in CSVDE.  You use the -r switch and then the LDAP query

(&(objectcateogry=person)(objectclass=user)(!memberof=DN of group))

Thanks

Mike
0
 
TasmantCommented:
as always mkline comment is perfect, but i would like to complete using the ADS_CHASING_REFERAL to exclude direct and nested members of the specified group:
dsquery * -limit 0 -filter "&(!memberof:1.2.840.113556.1.4.1941:=CN=Domain Admins,CN=Users,DC=eu,DC=airbus,DC=corp)" -attr samaccountname

Open in new window

you can use adfind as said with the filter given in the command-line.
the swith specified by mkline should be -f instead of -r.
0
 
JFTechAuthor Commented:
That did not seem to work for me. Error asking for a input file? What am i doing wrong?

C:\>csvde -r "&(objectcategory=person)(objectclass=user)(!memberof=Current Users) -f c:\current.csv
Invalid Parameter: Input file name required

CSV Directory Exchange

General Parameters
==================
-i              Turn on Import Mode (The default is Export)
-f filename     Input or Output filename
-s servername   The server to bind to (Default to DC of computer's domain)
-v              Turn on Verbose Mode
-c FromDN ToDN  Replace occurences of FromDN to ToDN
-j path         Log File Location
-t port         Port Number (default = 389)
-u              Use Unicode format
-?              Help


Export Specific
===============
-d RootDN       The root of the LDAP search (Default to Naming Context)
-r Filter       LDAP search filter (Default to "(objectClass=*)")
-p SearchScope  Search Scope (Base/OneLevel/Subtree)
-l list         List of attributes (comma separated) to look for in an
                LDAP search
-o list         List of attributes (comma separated) to omit from input.
-g              Disable Paged Search.
-m              Enable the SAM logic on export.
-n              Do not export binary values


Import
======
-k              The import will go on ignoring 'Constraint Violation' and
                'Object Already Exists' errors


Credentials Establishment
=========================
Note that if no credentials is specified, CSVDE will bind as the currently
logged on user, using SSPI.

-a UserDN [Password | *]            Simple authentication
-b UserName Domain [Password | *]   SSPI bind method

Example: Simple import of current domain
    csvde -i -f INPUT.CSV

Example: Simple export of current domain
    csvde -f OUTPUT.CSV

Example: Export of specific domain with credentials
    csvde -m -f OUTPUT.CSV
          -b USERNAME DOMAINNAME *
          -s SERVERNAME
          -d "cn=users,DC=DOMAINNAME,DC=Microsoft,DC=Com"
          -r "(objectClass=user)"
No log files were written.  In order to generate a log file, please
specify the log file path via the -j option.

C:\>
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
JFTechAuthor Commented:
I found your blog started the string with a "&( and your post you gave (&(


C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberof=Current Users) -f c:\current.csv
(objectclass was unexpected at this time.


Still errored.....
0
 
Mike KlineCommented:
Are you using the full DN for "current users"

Thanks

Mike
0
 
JFTechAuthor Commented:
Sorry I was not using DN like i should have. I tried it a few different ways after the '=' sign.
I still get an error:


C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberof=CN=Current Us
ers,CN=Users,DC=XXXX-IT,DC=NET) -f c:\current.csv
(objectclass was unexpected at this time.

C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberof= CN=Current U
sers,CN=Users,DC=XXXX-IT,DC=NET) -f c:\current.csv
(objectclass was unexpected at this time.

C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberofCN=Current Use
rs,CN=Users,DC=XXX-IT,DC=NET) -f c:\current.csv
(objectclass was unexpected at this time.

C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberof CN=Current Us
ers SEI,CN=Users,DC=SEI-IT,DC=NET) -f c:\current.csv
(objectclass was unexpected at this time.
0
 
JFTechAuthor Commented:
I missed a closing ' ) ' got it in these but it still errors:

C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberof=CN=Current Us
ers SEI,CN=Users,DC=SEI-IT,DC=NET)) -f c:\current.csv
(objectclass was unexpected at this time.

C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberof= CN=Current U
sers SEI,CN=Users,DC=SEI-IT,DC=NET)) -f c:\current.csv
(objectclass was unexpected at this time.

C:\>csvde -r (&(objectcategory=person)(objectclass=user)(!memberofCN=Current Use
rs SEI,CN=Users,DC=SEI-IT,DC=NET)) -f c:\current.csv
(objectclass was unexpected at this time.
0
 
Mike KlineCommented:
put the query in quotes "(&(....))"

I'll be able to test in about 45 minutes.

It definitely works using adfind  http://adisfun.blogspot.com/2009/06/find-users-who-are-not-in-specific.html

Thanks

Mike
0
 
JFTechAuthor Commented:
Quotes seemed to let it run this time but it gave no out put. I need a list of all users not a member of this current users group. Thanks for helping!!

C:\>csvde -r "(&(objectcategory=person)(objectclass=user)(!memberof CN=Current U
sers SEI,CN=Users,DC=SEI-IT,DC=NET))" -f c:\current.csv
Connecting to "(null)"
Logging in as current user using SSPI
Exporting directory to file c:\current.csv
Searching for entries...
Writing out entries

No Entries found

The command has completed successfully
0
 
Mike KlineCommented:
Try

!memberof=CN=Current U

You forgot that one "=" sign

Thanks

Mike
0
 
JFTechAuthor Commented:
Thanks mkline71!
That fixed it!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now