Discussion:
DSQUERY and DSMOD
(too old to reply)
NTNEWS
2004-09-10 00:33:02 UTC
Permalink
I have setup a DSQUERY script to see who in my entire domain has a certain
attribute set. Once I have this info, I want to use DSMOD to nullify (or
change) that attribute. Will DSMOD allow me to point to a list (CSV file
maybe) of users and change an attribute. I cannot seem to find a switch? If
not, what may be a better way if these users are spead throughout my AD ou's.
(Running Windows 2000 Native mode with a mix of Win2K and Win2003 DC's).

Also, is there a switch with 'DSMOD group' to add a mass of users to a
particular group? (maybe via a csv file as well?) If not any ideas how to
mass import hundreds of users (already exist in AD) into an existing group? I
have a csv file of the users and what group I need them in.

thanksalot!
NTNEWS
Jerold Schulman
2004-09-10 13:15:41 UTC
Permalink
Post by NTNEWS
I have setup a DSQUERY script to see who in my entire domain has a certain
attribute set. Once I have this info, I want to use DSMOD to nullify (or
change) that attribute. Will DSMOD allow me to point to a list (CSV file
maybe) of users and change an attribute. I cannot seem to find a switch? If
not, what may be a better way if these users are spead throughout my AD ou's.
(Running Windows 2000 Native mode with a mix of Win2K and Win2003 DC's).
Also, is there a switch with 'DSMOD group' to add a mass of users to a
particular group? (maybe via a csv file as well?) If not any ideas how to
mass import hundreds of users (already exist in AD) into an existing group? I
have a csv file of the users and what group I need them in.
thanksalot!
NTNEWS
The are a number of ways. The easiest is to have the dsquery output only the DN
and pipe it to the dismod:

dsquery user ....... -o DN|dsmod user -attribswitch value

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"

To add all users from the OU "Marketing" to the exisitng group
"Marketing Staff":

dsquery user ou=Marketing,dc=microsoft,dc=com | dsmod group
"cn=Marketing Staff,ou=Marketing,dc=microsoft,dc=com" -addmbr

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com

Continue reading on narkive:
Loading...