Command line Administration - Win2000/03 Server


I

it_chick

Hi,

I've been asked to use MSDOS (as opposed to any
GUI/scripting tools) to write "bulk" commands for
add/use/modify etc. for multiple Active Directory users at
a time, but they are not ou groups. These users would
have several attributes attached to their objects (ie
name, samid, ds, email, phone, etc.

Can anyone help? The ds command has been suggested (ie
dsquery, dsadd, dsmod, etc.) but I need assistance with
explanations/syntax, etc.
 
Ad

Advertisements

C

Cary Shultz [A.D. MVP]

IT Chick!

I would strongly suggest either the ds tools or ldifde! But I am on a
ldifde kick today ( so take that with a grain of salt ). There are other
tools out there as well ( such as csvde and addusers.exe ).

ldifde is 'built-in' to WIN2000 / WIN2003 ( as is csvde ). Essentially you
would create an .ldf file with all of the information that you want to
include and then use the ldifde command at a command prompt to import that
file in to your AD.

Here is an example of what that .ldf file could look like:

DN: cn=Cary Shultz,OU=IT,OU=Departments,DC=nkdsolutions,DC=com
changeType: add
userAccountControl: 512
sAMAccount: cshultz
displayName: Cary Shultz
cn: Cary Shultz
givenName: Cary
sn: Shultz
company: NKD Solutions, Inc.
streetAddress: 123 Main Street
l: Roanoke
st: VA
postalCode: 24014
c: US
co: United States
countryCode: 840
department: IT
physicalDeliveryOfficeName: Roanoke
telephoneNumber: 540.555.1212

DN: cn=Natasha Shultz,OU=IT,OU=Departments,DC=nkdsolutions,DC=com
changeType: add
userAccountControl: 512
sAMAccount: nshultz
displayName: Natasha Shultz
cn: Natasha Shultz
givenName: Natasha
sn: Shultz
company: NKD Solutions, Inc.
streetAddress: 123 Main Street
l: Roanoke
st: VA
postalCode: 24014
c: US
co: United States
countryCode: 840
department: IT
physicalDeliveryOfficeName: Roanoke
telephoneNumber: 540.555.1212


You would simply create this in Notepad. Do not use WordPad or Word as this
will cause problems. Stick with Notepad.

Please take a look at the following MSKB Article for a more detailed
description of using ldifde:

http://support.microsoft.com/?id=237677
http://www.ietf.org/rfc/rfc2256.txt
http://www.ietf.org/rfc/rfc2798.txt
http://www.ietf.org/rfc/rfc2849.txt

You do not necessarily need to include all this information in the .ldf file
if you do not want to as you can use ADModify to make mass changes.
However, you might as well do it in the .ldf file. You can download
ADModify from the following MS FTP site:

ftp://ftp.microsoft.com/PSS/Tools/Exchange%20Support%20Tools/ADModify/

Essentially ADModify is a tool that allows you to make the same change to
multiple users. It is very nice. Please be advised that there is a more
recent version ( I can e-mail it to you if you need it ) that resolves the
'Office' field issue ( BTW - the 'Office' field is represented by the
physicalDeliveryOfficeName entry that you see at the bottom of each user ).

You will also notice that there is no password field in the .ldf file. If
this is important you might want to look at either addusers.exe ( from the
Resource Kit - I sometimes use it and then use either ldifde or ADModify to
'fill in the blanks' ).

Please look at the following MSKB Article for help on addusers.exe:

http://support.microsoft.com/?id=199878

The new ds tools are looking really neat. I have not played with them yet
but they do look pretty powerful. They are actually a WIN2003 Server tool
but you can use them in a WIN2000 environment so long as your DCs are at
Service Pack 3 or greater. You might also want to consider 'upgrading' your
AD Schema by running the adprep /forestprep on the DC that holds the FSMO
Role of Schema Admin. After this has replicated to all of your Domain
Controllers in your entire Forest you need to then run adprep /domainprep on
the DC that holds the FSMO Role of Infrastructure Master in each of your
Domains. Be aware that if you have Exchange 2000 in your environment there
is a possibility that running the adprep utility *could* cause a problem
with mangled attributes. Please take a look at the following MSKB Articles
for the details ( and the fix! ):

http://support.microsoft.com/?id=314649

Here is the information for the ds tools:

http://support.microsoft.com/?id=325465
http://support.microsoft.com/?id=298882

I know that this is a lot but there are several possibilities here.

HTH,

Cary
 

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

Top