ActiveDirect批理操作

导出群组中的成员信息
for /F "tokens=*" %i in (c:\group.txt) do dsquery group -name %i | dsget group -members | dsget user -samid >>d:\group\%i
批量移动用��
for /F "tokens=* " %a in (c:\user.txt) do dsquery user -samid %a | dsmove -newparent OU=XXX,OU=XXX,DC=TEST,DC=hw,DC=com >>%windir%\temp\log.txt
批量新增加�ず�
user文件格式:姓名/工号/名字/姓氏/部�T描述
for /F "tokens=1,2,3,4,5* delims=/ " %%a in (c:\user.txt) do dsadd user"cn=%%a,ou=New_Account,ou=TE,dc=TEST,dc=hw,dc=com" -samid %%b -upn %%[email protected] -fn %%c -ln %%d -display %%a -email %%[email protected] -desc %%e -pwd 9512690. -mustchpwd yes -pager "%username% %Today% %time%" -company "%username%批量新增�ず�" >>%windir%\temp\log.txt
批量新禁用�ず�
for /F "tokens=* " %%a in (c:\user.txt) do dsquery user -samid %%a | dsmod user -disabled Yes

 

你可能感兴趣的:(ad)