Dsquery/Dsmod


Joined
Jul 23, 2009
Messages
2
Reaction score
0
Hi All,



I need to create a batch file or script to find users with specific attribute & add them to a group. I need this script to run on schedule task so that my security group is updated. we have specified this attribute to all users whenever there is any new joiner in our organization.



we have created a custom attribute in AD "extensionattribute3" to specify the user team vertical. we have around 15 such verticals. I need to find users with specific vertical & add them to a security group.



I can extract the list of users with specific attribute & dump the file on local machine but I’m not able to find the solution to add them to group.





This is the script which I’m using as of now



dsquery * -filter "(&(&(objectcategory=person)(objectclass=user))(|(extensionattribute3=Abc.sales)))" -attr sAMAccountName extensionAttribute3 -limit 0 >c:\abc.txt
 
Ad

Advertisements

Joined
Jan 13, 2010
Messages
19
Reaction score
0
HI,

try this

http://www.windowstricks.in/2009/06/how-to-add-all-members-of-one-group-to.html

and use the below command

c:\For /f %a in (abc.txt) do dsmod "security group DN" -addmbr %a

abc.txt file should have the list of user DN

find the LDAP path

http://www.windowstricks.in/2009/06/find-distinguished-name-ldap-bath-for.html

Exe:

To add three new members to the US Info group:
dsmod group "CN=US INFO,OU=Distribution Lists,DC=microsoft,DC=com" -addmbr
"CN=John Smith,CN=Users,DC=microsoft,DC=com"
"CN=Datacenter,OU=Distribution Lists,DC=microsoft,DC=com"
"CN=Jane Smith,CN=Users,DC=microsoft,DC=com"



Ganesamoorthy.S
www.windowstricks.in
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DSMOD 4
Dsquery 2
DSMOD 5
Dsmod utility 1
dsget and dsquery 4
dsquery 2
DSQuery 3
dsquery tool 5

Top