Jump to content

extracting the list of Users in a group using dscl


Recommended Posts

Posted

Hello,

 

I am trying to extract a list if the users inside an AD group using the dscl command in OS X terminal.

 

So far i can get to the groups using the command:

 

dscl /Active\ Directory/All\ Domains/Groups/

 

Now i hit the problem. If i try to list the Staff\ Group and then read the PrimaryGroupID and use $1,$2 > filename.txt, it doesn't read any data or it throws an error.

 

How can i get to the group Staff\ Group to read the attributes and extract the list of users in the group?

 

Thanks for your help.

:D

Posted

I am trying to create a script for the home dirs of the users in AD on the OS X Server (see the coding forum). I need to be able to list the group members so i can extract the staff group users and create their home dirs in the Staff folder.

 

I also then need to be able to extract the pupils users and create their home dir into their own pupil folder. I could just create a single user dir for all of them i suppose

 

I also would like to extract the PrimaryGroupID so i could chown using the UniqueID:PrimaryGroupID /Users/$1Username

 

This should then sort out the permissions side of things. So far i have managed to get the list of Users and their corresponding UIDs and using this list created their home dirs and also copied the pre-created home dir template into each one. I just now need to sort out the permissions

:D

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...