username帐号名
password分配或改变密码
*密码提示
/domain在一个域中执行
/add创建一个帐号
/delete删除一个帐户
/active:
[yesorno]激活或停止一个帐号
/comment:
""加入描述性说明
/counterycode.nnnnnn是系统编码.0为系统缺省值
/expires:
帐号到期时间.格式:
月,日,年或日,月,年(
格式由国家代码决定)
/fullname:
""帐号全名
/homedir:
用户主目录路径
/passwordchg:
[yesorno]设置用户能否更改密码
/passwordreq:
[yesorno]设置用户是否需要密码
/profilepath:
设置环境文件路径
/scriptpath:
登录脚本路径
/times:
用户可以登录的小时数
/usercomment:
""帐号说明信息
/workstations:
允许登录的用户名.*表示所有用户.
注意,netuser***/参数之中“/”与***之间有空格。
以下示例显示netuser命令的语法:
netuser[username[password|*][options]][/domain]
username{password|*}/add[options][/domain]
username[/delete][/domain]
可使用netuser命令来创建和修改计算机上用户帐户。
当您使用此命令不
带命令行开关,列出用户帐户对计算机。
用户帐户信息是存储用户帐户数据库中
。
此命令只适用于服务器。
您可以使用以下参数:
netuser命令
用户名
是要添加、删除、修改,或查看用户帐户的名称。
可有多达20字符的用
户帐户名称。
密码
为用户帐户指派或更改密码。
密码必须满足最小长度设置与/minpwlen选
项是网络帐户命令。
它可以包含多达14个字符。
*
产生提示输入密码。
在密码提示您键入密码时是不显示密码。
/domain
主域控制器(PDC)上执行操作的当前域。
此参数适用于运行
WindowsNTWorkstation,都是WindowsNTServer域成员计算机仅。
默认情况下
WindowsNTServer-基于计算机执行PDC上操作。
/add
将用户帐户添加到用户帐户数据库。
/delete
从用户帐户数据库删除用户帐户。
netuser命令选项
/活动:
{}是没有|
激活或停用帐户。
如果帐户不是活动,用户无法访问到服务器。
默认为是
。
/注释:
"文本"
提供有关用户描述性注释是帐户的48个字符(大)一定要将使用文本两侧
加引号。
/countrycode:
nnn
使用操作系统国家代码来实现用于用户帮助和错误消息指定语言文件。
值为
0表示默认国家代码。
/过期:
{}日期从不|
使帐户以过期如果日期设置。
从不选项设置帐户上没有时间限制。
过期日
期位于表单mm/dd/yydd或根据国家代码年/月/日。
月可以是数字,拼写,
或与三字母缩写。
年份可以是两个或四个数字。
使用斜线(/)用没有空格来分
隔日期部分。
/:
"名称"fullname
是用户的全名(而不是用户名)。
将名称用括起来。
/homedir路径名:
设置为用户主目录路径。
路径必须存在。
/passwordchg|{}是没有:
指定用户是否可更改自己密码。
默认为是。
/passwordreq|{}是没有:
指定是否必须有一个用户帐户密码。
默认为是。
/profilepath[路径]:
设置登录用户配置文件路径。
/scriptpath路径名:
是用户的登录脚本位置。
/时间:
{}时间所有|
是登录时间。
如工作日[-天]表示时间选项,限于1小时增量[、
天[-天]],时间[-时间][,时间[-时间]],。
日期可以拼写或
缩写。
小时可以12小时制或24小时标记。
表示法,12-小时使用am、pm
、a.m或p.m.所有选项指定,用户可始终登录,和空值指定从不可登录用户
。
分隔日期和时间带有逗号,条目并用分号分隔多天和时间项。
/usercomment:
"文本"
允许管理员添加或更改对帐户用户注释。
/workstations:
{|computername}*[,]
列出多达八计算机从其用户可登录到网络。
如果,用户可从任何计算机登
录/工作站选项具有没有列表或者列表是*。
net帮助用户更多|
每次显示帮助一屏。
注意:
时可获取所有通过键入下列命令包含本文中的信息:
nethelpuser
netuser命令的用法
[2]
建立一个普通新用户
在MS-DOS提示符中输入如下命令:
“netuserjohn123/add”,回车。
即
可新建一个名为“John”,密码为“123”的新用户。
Add参数表示新建用户。
值得注意的是:
用户名最多可有20个字符,密码最多可有127个字符。
建立一个登录时间受限制的用户
用以下方法可实现对电脑使用时间的控制。
比如,需要建立一个John的用户
账号,密码为“123”,登录权限从星期一到星期五的早上八点到晚上十点和双休
日的晚上七点到晚上九点。
1.12小时制可键入如下命令:
“netuserjohn123/add/times:
monday-
friday,8AM-10PM;saturday-sunday,7PM-9PM”,回车确定即可。
2.24小时制可键入如下命令:
“netuserjohn123/add/times:
M-
F,8:
00-22:
00;Sa-Su,19:
00-21:
00”,回车确定即可。
值得注意的是:
Time的增加值限制为1小时。
对于Day值,可以用全称或缩写
(即M、T、W、Th、F、Sa、Su)。
可以使用12小时或24小时时间表示法。
对于12
小时表示法,请使用AM、PM或A.M.、P.M.。
All值表示用户始终可以登录;空值(
空白)意味着用户永远不能登录。
用逗号分隔日期和时间,用分号分隔日期和时
间单元(例如,M,4AM-5PM;T,1PM-3PM)。
指定时间时不要使用空格。
另外,Passwordchg:
{yes|no}参数可用来指定用户是否可以更改自己的密
码,默认设置为Yes。
限定用户的使用时间
限定用户的使用时间
NetUser命令还可以使用参数Expires:
{{mm/dd/yyyy|dd/mm/yyyy|
mmm,dd,yyyy}|never}使用户账号根据指定的Date过期限定用户。
过期日期可
以是[mm/dd/yyyy]、[dd/mm/yyyy]或[mmm,dd,yyyy]格式。
它取决于国家(地区
)代码。
用户账号在指定日期开始时到期。
对于月份值,可以使用数字、全称或
三个字母的缩写(即Jan、Feb、Mar、Apr、May、Jun、Jul、Aug、Sep、Oct、Nov
、Dec)。
对于年份值,可以使用两位数或四位数;使用逗号和斜杠分隔日期的各
部分;不要使用空格。
例如:
要限定用户账号John到2004年11月5日到期,可键入如下命令:
“net
userjohn/expires:
Nov/5/2004”,回车确定即可。
查看用户信息、修改已有用户密码和删除用户
如果在没有参数的情况下使用,则NetUser将显示计算机上用户的列表,如
键入以下命令:
“netuser”,回车即可显示该系统的所有用户。
如果键入:
“netuserjohn”,回车则可显示用户John的信息。
若键入命令:
“netuserjohn123456/add”,回车确定,则强制将用户
John(John为已有用户)的密码更改为123456。
"netlocalgroupadministratorsjohn/add"则把用户john的权限提为系统管理
员(将其加入了administrators用户组)
若键入命令:
“netuserjohn/delete”,回车确定则可删除用户John
显示名称
属性名称
FirstName
givenName
LastName
sn
Initials
initials
Description
description
Office
physicalDeliveryOfficeName
TelephoneNumber
telephoneNumber
Telephone:
Other
otherTelephone
E-Mail
mail
WebPage
wwwHomePage
WebPage:
Other
url
帐号属性:
显示名称
属性名称
UserLogonName
userPrincipalName
Userlogonname(pre-Windows2000)
sAMAccountname
LogonHours
logonHours
LogOnTo
logonWorkstation
Accountislockedout
userAccountControl
Usermustchangepasswordatnextlogon
pwdLastSet
Usercannotchangepassword
N/A
OtherAccountOptions
userAccountControl
AccountExpires
accountExpires
地址属性
显示名称
属性名称
Street
streetAddress
P.O.Box
postOfficeBox
City
l
State/Province
st
Zip/PostalCode
postalCode
Country/Region
c,co,andcountryCode
成员属性
显示名称
属性名称
Memberof
memberOf
SetPrimaryGroup
primaryGroupID
组织属性
显示名称
属性名称
Title
title
Department
department
Company
company
Manager:
Name
manager
DirectReports
directReports
外型属性
显示名称
属性名称
ProfilePath
profilePath
LogonScript
scriptPath
HomeFolder:
LocalPath
homeDirectory
HomeFolder:
Connect
homeDrive
HomeFolder:
To
homeDirectory
电话相关属性
显示名称
属性名称
Home
telephoneNumber
Home:
Other
otherTelephone
Pager
pager
Pager:
Other
pagerOther
Mobile
mobile
Mobile:
Other
otherMobile
Fax
facsimileTelephoneNumber
Fax:
Other
otherFacsimileTelephoneNumber
IPphone
ipPhone
IPphone:
Other
otherIpPhone
Notes
info
LDAPAttribute
Example
CN-CommonName
CN=GuyThomas. Actually,thisLDAPattributecanbemadeupfromgivenNamejoinedtoSN.
CN
Mapsto'Name'intheLDAPprovider.RememberCNisamandatoryproperty. SeealsosAMAccountName.
description
WhatyouseeinActiveDirectoryUsersandComputers. NottobeconfusedwithdisplayNameontheUserspropertysheet.
displayName
displayName=GuyThomas. Ifyouscriptthisproperty,besureyouunderstandwhichfieldyouareconfiguring. DisplayNamecanbeconfusedwithCNordescription.
Displayname-v-Description
ImportantLDAPNotes
DisplaynameandDescriptionaredifferent
Office'sLDAPattributeis:
physicalDeliveryOfficeName
E-mailisplain:
mail
DN-alsodistinguishedName
DNissimplythemostimportantLDAPattribute.
CN=JayJamieson,OU=Newport,DC=cp,DC=com
givenName
FirstnamealsocalledChristianname
homeDrive
HomeFolder:
connect. Trickytoconfigure
name
name=GuyThomas. ExactlythesameasCN.
objectCategory
DefinestheActiveDirectorySchemacategory.Forexample,objectCategory=Person
objectClass
objectClass=User. AlsousedforComputer,organizationalUnit,evencontainer. Importanttoplevelcontainer.
physicalDeliveryOfficeName
Office!
ontheuser'sGeneralpropertysheet
profilePath
Roamingprofilepath:
connect. Tricktosetup
sAMAccountName
Thisisamandatoryproperty,sAMAccountName=guyt. TheoldNT4.0logonname,mustbeuniqueinthedomain.
sAMAccountName
IfyouareusinganLDAPprovider'Name'automaticallymapstosAMAcountNameandCN.ThedefaultvalueissameasCN,butcanbegivenadifferentvalue.
SN
SN=Thomas.Thiswouldbereferredtoaslastnameorsurname.
userAccountControl
Usedtodisableanaccount. Avalueof514disablestheaccount,while512makestheaccountreadyforlogon.
userPrincipalName
userPrincipalName=guyt@CP.com OftenabbreviatedtoUPN,andlookslikeanemailaddress. VeryusefulforloggingonespeciallyinalargeForest. NoteUPNmustbeuniqueintheforest.
ExamplesofExchangeSpecificLDAPattributes
homeMDB
HereiswhereyousettheMailStore
legacyExchangeDN
LegacydistinguishednameforcreatingContacts.Inthefollowingexample,
GuyThomasisaContactinthefirstadministrativegroupofGUYDOMAIN:
/o=GUYDOMAIN/ou=firstadministrativegroup/cn=Recipients/cn=GuyThomas
mail
Aneasy,butimportantattribute. AsimpleSMTPaddressisallthatisrequiredbillyn@
mAPIRecipient-FALSE
Indicatesthatacontactisnotadomainuser.
mailNickname
NormallythisisthesamevalueasthesAMAccountName,butcouldbedifferentifyouwished. Neededformailenabledcontacts.
mDBUseDefaults
Anotherstraightforwardfield,justthevalueto:
True
msExchHomeServerName
Exchangeneedstoknowwhichservertodeliverthemail. Example:
/o=YourOrg/ou=FirstAdministrativeGroup/cn=Configuration/cn=Servers/cn=MailSrv
proxyAddresses
Asthename'proxy'suggests,itispossibleforonerecipienttohavemorethanoneemailaddress. NotethepluralspellingofproxyAddresses.
targetAddress
SMTP:
@e-mailaddress. NotethatSMTPiscasesensitive. Allcapitalsmeansthedefaultaddress.
showInAddressBook
DisplaysthecontactintheGlobalAddressList.
OtherUsefulLDAPAttributes/Propeties
c
CountryorRegion
company
Companyororganizationname
department
Usefulcategorytofillinanduseforfiltering
homephone
HomePhonenumber,(LotsmorephoneLDAPs)
l (LowercaseL)
L=Location. City(MaybeOffice
location
Important,particularlyforprintersandcomputers.
manager
Boss,manager
mobile
MobilePhonenumber
ObjectClass
Usually,User,orComputer
OU
Organizationalunit. SeealsoDN
pwdLastSet
Forceuserstochangetheirpasswordsatnextlogon
postalCode
Ziporpostcode
st
State,ProvinceorCounty
streetAddress
Firstlineofaddress
telephoneNumber
OfficePhone
userAccountControl
Enable(512)/disableaccount(514)