批量添加域账户 2种方法
来源:互联网 发布:linux tomcat安装配置 编辑:程序博客网 时间:2024/06/06 09:00
批量添加域账户 方法1
======================================================
For /F "tokens=1,2" %%a in (UserList.txt) do dsadd user CN=%%a,OU=test,DC=altn,DC=Com -upn %%a@altn.com -display %%b -pwd p@ssw0rd -pwdneverexpires yes
======================================================
---------------------------------------------------------
dsadd user "CN=zwx167215,CN=Users,OU=myusers,DC=zhoujie-c54800c,DC=china,DC=local" -display "zhou jie" -pwd p@ssw0rd001 -mustchpwd yes
---------------------------------------------------------
UserList.txt (拼音和中文名之间有一个空格)
======================================================
zhangsan 张三
lisi 李四
wangwu 王五
======================================================
如果是xxx.a.com.cn.local这种情况的话,OU=MyNames,OU=Users,OU后面要写成,dc=a,dc=com,dc=cn,dc=local ! 其实把它看成一个路径就行,告诉DSADD命令在哪个路径下添加新的域用户,可以打开adsiedit.msc来查看你现有用户,参考进行添写!
批量添加域账户 方法2
http://support.microsoft.com/kb/199878/en-us
AddUsers Automates Creation of a Large Number of Users
System TipThis article applies to a different version of Windows than the one you are using. Content in this article may not be relevant to you. Visit the Windows XP Solution Center
This article was previously published under Q199878
SUMMARY
The Addusers.exe tool for Windows is a 32-bit administrative utility that uses a comma-delimited text file to create, modify, and delete user accounts. Addusers is most beneficial when the information to be manipulated is maintained in a spreadsheet, such as one created with Microsoft Excel, that can be converted to a comma-delimited file. You must be a member of the Administrators group on the target computer to add accounts and a member of the Users group to write to accounts.
Back to the top |Give Feedback
MORE INFORMATION
The AddUsers command uses the following syntax:AddUsers {/c|/d{:u}|/e} filename [/s:x] [/?] [\\computername|domainname] [/p:{l|c|e|d}]
- \\computername - is the computer where you want to create user accounts or from which you want to write user accounts. If you do not specifycomputername, AddUsers uses the local computer by default.
- domainname - This option can be used in place of computername. If this option is used, then Addusers queries the PDC of the domain specified.
- /c - Creates user accounts, local groups, and global groups as specified by filename.
- /d{:u} - Dumps user accounts, local groups, and global groups to the specified file name. The (:u) is an optional switch that causes current accounts to be written to the specified file in Unicode text format. Choosing to dump current user accounts does not save the account's passwords or any security information for the accounts. To back up security information for accounts, a Tape Backup should be used.Note: Password information is not saved in a user account dump and if you use the same file to create accounts, all passwords of newly created accounts will be empty. All created users are required to change their password at logon by default.
- /e - Erases the user accounts specified in the file name.CAUTION: Be careful when erasing user accounts, as it is not possible to recreate the user account with the same SID. This option, however, cannot erase built-in accounts.
- Filename - The comma-delimited input/output file that AddUsers uses for data.
- /s:x - This a optional switch that changes the character used for separating fields in the file. Thex should be replaced with the new character to be used for separating fields. For example,/s:~ would make the field-separation character the "~" (tilde). If this option is not specified, the default separator, a comma, is used.
- /? - Displays a help screen.
- If you are using Windows NT 4.0, the newer version of Addusers.exe is available in the Windows NT Resource Kit, Supplement 3, has added a /p switch. This switch increases functionality when creating new users with AddUsers.exe in Windows NT.
- /p: - Sets account creation options. It can be used along with any combination of the following options:
- l - Users do not have to change passwords at next logon.
- c - Users cannot change passwords.
- e - Passwords never expire. (implies l option)
- d - Accounts disabled.
Sample: Creating New Users and Groups with Addusers
- Log on as a user who is a member of the Administrators group of the target computer.
- Create a comma-delimited text file, which contains the new users and groups to be created. Syntax is section-specific for each entry (line) in the different sections, as follows:
[Users]
User Name,Full name, Password, Description, HomeDrive, Homepath, Profile, Script
[Global]
Global Group Name, Comment, UserName, ...
[Local]
Local Group Name, Comment>, UserName, ...
The entries (lines) in the [Local] and [Global] group sections can have 0 or moreUserName entries after the comment field. Each user name is added to that group. Lines must end with a comma (or the appropriate separator character). Here is the example from the Resource Kit Tools Help file for AddUsers.exe:
[User]
jimmy,James Edward Phillip II,,,,,,
alex,Alex Denuur,,,E:\,E:\users\alex,,
ron,Ron Jarook,hello,,E:\,E:\users\ron,,
sarah,Sarah Selly,,,,,,
mike,Mike Olarte,,,,,,
[Global]
TestTeam,Regression,ron,alex,
DevTeam,Conversion to Sources,mike,sarah,jimmy,
[Local]
UsersAM,Users A through M,alex,jimmy,mike,
UsersNZ,Users N through Z,ron,sarah, - Save the file.
- Creating the users (and groups) can be performed through a batch file or at the command line. The following command creates the users and groupslisted in a text file called Users.txt. The "/p" switch creates the userswith the Passwords Never Expire option enabled:
C:\>AddUsers [\\computername] /c c:\Users.txt /p:e
Alternatively, using a domain name, the syntax would be:
C:\>AddUsers [domainname] /c c:\Users.txt /p:e
Sample: Generating a List of User Accounts and Groups from a Computer Running Windows
- Log on as a user who is a member of the Administrators group of the target computer.
- At a command prompt, type Addusers \\servername /dfilename.txt (where servername is the name of a domain controller, member server, or workstation), and then press Enter.
For additional information about creating batch files to automate the creation of users, please see the following article in the Microsoft Knowledge Base:180546 Automating Updates to Local Groups on Member Servers
2、执行命令
参数解释:
计算机名:要建立帐号的计算机名
/c:使用文件引入用户列表
file path:加/c参数后,指定文件路径
/p:l/c/e/d:帐号选项,其中:
l:使用者下次登录时需更改密码
c:使用者不得变更密码
e:密码永远有效
d:帐号暂停使用
- 批量添加域账户 2种方法
- 利用脚本批量添加域用户账户
- 利用脚本批量添加域用户账户
- 利用脚本批量添加域用户账户
- linux 命令 自动 批量 添加账户
- 解读shell之批量添加账户
- 利用CSVDE命令实现域用户账户的批量添加示例
- 利用CSVDE命令实现域用户账户的批量添加示例
- 利用CSVDE命令实现域用户账户的批量添加示例
- 利用CSVDE命令实现域用户账户的批量添加示例
- 批量添加记录方法
- 批量添加方法
- 批量添加友情链接方法:
- 批量添加crontab 方法
- win2008r2 AD用户账户的批量导入方法
- 批量添加联系人的方法
- Windows 下批量添加IP的几种方法
- Windows 2003批量添加IP的几种方法
- MMC 驱动分析
- [Oracle] 搞懂Oracle字符集
- C++子类的函数无法直接访问父类protected变量的疑惑
- 银行业务调度系统
- 关于yaf的控制器命名,一个纠结的问题。
- 批量添加域账户 2种方法
- 用java实现MD5密码加密
- Leetcode上和DFS有关题目整理 (内含目录)
- UITabBar的常用设置
- 页游通信及数据结构
- Leetcode Subset I & II
- 【PERL笔记1】perl Tk 简单部件的应用
- Leetcode Permutation I & II
- KUbuntu 实现中文支持shell命令