Information Technology Reference
In-Depth Information
3. Create a security group called Advert-G with global scope.
4. Click Start , type Notepad in the Start Search text box, and press Enter .
5. In Notepad, type the following on one line: DSADD user "CN=%1, OU=Advertising,
OU=Marketing, DC=w2k8adXX, DC=com" -fn %2 -ln %3 -upn %1@w2k8adXX.com
-pwd Password01 -memberof "CN=Advert-G, OU=Advertising, OU=Marketing,
DC=w2k8adXX, DC=com" -mustchpwd yes .
6. Save the file as C:\uadd.bat . Because Notepad adds the .txt extension automatically, enclose
the filename in quotation marks to preserve the .bat extension. Exit Notepad.
7. Open a command prompt window. Type C:\uadd AdvUser1 Advertising User1 and press Enter .
8. The last line of the command output should start with “dsadd succeeded.” If DSADD failed,
check the syntax in the uadd.bat file. Make sure there's a space between the option name
and the option value, and you replaced XX with your student number in all three places
your domain name appears.
9. Refresh the view in Active Directory Users and Computers by clicking Action , Refresh from
the menu or clicking the Refresh toolbar icon. The user you just created should appear in
the Advertising OU and be a member of the Advert-G group.
10. Create two more users named AdvUser2 and AdvUser3 (with first names and last names in
the format shown in Step 7) by using the batch file. Leave Active Directory Users and
Computers and the command prompt window open for the next activity.
One benefit of some command-line programs is that you can use the output of one as input
to another, called piping . You can use piping with the DSQUERY and DSMOD commands, but
it's not unique to directory service commands. One of the most common uses of piping is to send
the output of any command displaying more than one screen of information to the more pro-
gram. You can try it by displaying the help information for a command:
DSMOD user /? | more
The vertical bar, called a “pipe,” specifies sending the output of DSMOD user /? to the more
program, which simply paginates information it receives so that you can view one page of output
at a time. In the following activity, you use DSQUERY to find and display Active Directory infor-
mation and then use a pipe to DSMOD to add users to a group.
Activity 5-12: Using DSQUERY and DSMOD with a Pipe
Time Required: 10 minutes
Objective: Pipe output from DSQUERY to DSMOD to add users to a group.
Description: All users in the Marketing OU and all OUs under it need to be added to a new
group called Marketing-G. You create the group and use DSQUERY and DSMOD to assign
group memberships.
1. If necessary, log on to your server as Administrator, open a command prompt window, and
open Active Directory Users and Computers.
2. At the command prompt, type DSADD group "CN=Marketing-G, OU=Marketing,
DC=w2k8adXX, DC=com" and press Enter .
By default, groups are created as global security groups. Therefore, as
shown in the command in Step 2, you don't need to specify group scope
and type unless the group you're creating has different settings.
3. Type DSQUERY user OU=Marketing,DC=w2k8adXX,DC=com and press Enter . (You
don't have to use quotation marks if there are no spaces in the DN path.) The output should
be a list of all users, shown in DN format, in the Marketing OU and all its child OUs. This
data is what's piped to the DSMOD command in the next step.
 
Search WWH ::




Custom Search