对一些管理员来讲添加账号是个很是简单的事,只要点几下鼠标敲几下键盘就能够解决,一旦提到用命令行方式来添加账号和
OU
就不怎么熟悉了,首先我先看一下添加
OU
的命令行表达方式
dsadd ou <OrganizationalUnitDN> [-desc <Description>]
[{-s <Server> | -d <Domain>}] [-u <UserName>]
[-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]
运用范例
Dsadd ou ou=
财务部
,dc=test,dc=com
ou=
财务部
意思是你要添加组织单位是财务部,
dc=test,dc=com
意思是财务部是在
test.com
的
Domain
内,也就是你的
Domain
是
test.com
添加
user
命令为
dsadd user <UserDN> [-samid <SAMName>] [-upn <UPN>] [-fn <FirstName>]
[-mi <Initial>] [-ln <LastName>] [-display <DisplayName>]
[-empid <EmployeeID>] [-pwd {<Password> | *}] [-desc <Description>]
[-memberof <Group ...>] [-office <Office>] [-tel <Phone#>]
[-email <Email>] [-hometel <HomePhone#>] [-pager <Pager#>]
[-mobile <CellPhone#>] [-fax <Fax#>] [-iptel <IPPhone#>]
[-webpg <WebPage>] [-title <Title>] [-dept <Department>]
[-company <Company>] [-mgr <Manager>] [-hmdir <HomeDir>]
[-hmdrv <DriveLtr:>] [-profile <ProfilePath>] [-loscr <ScriptPath>]
[-mustchpwd {yes | no}] [-canchpwd {yes | no}]
[-reversiblepwd {yes | no}] [-pwdneverexpires {yes | no}]
[-acctexpires <NumDays>] [-disabled {yes | no}]
[{-s <Server> | -d <Domain>}] [-u <UserName>]
[-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]
运用范例
dsadd user cn=
林坚
,ou=
总经办
,dc=test,dc=com -upn [email]Darren.Lam@test.com[/email] -pwd 8888888 -display
林坚
-fn
坚
-ln
林
-mustchpwd yes -disabled no -samid Darren.Lam
-upn
就是平时咱们所用的
mail
地址表达方式
–pwd 888888
密码为
888888 -display
林坚
显示名为林坚
-fn
坚
-ln
林
名为坚姓为林
-mustchpwd yes
第一次登录更改密码
是
-disabled no
禁用账号
不
-samid Darren.Lam SAMName
为
Darren.Lam
值得注意的是,批处理作好了不能立刻就进行导入账号,你们可能问为何呢?理由很简单,在默认状况下
AD
的策略是密码复杂性和密码长度是开启的,因此咱们上面所建密码是不适合的,即使你导入了,全部的用户都是被禁用的