The simple answer is to use the net user /add (/domain) , owever it is possible to automate not only the addition of the user, but also his/her addition to groups and the creation of a template user account directory structure. Many organizations have a basic structure with word, excel directories and some template files. This can be automated with a basic script. For example

addnew.bat

net user %1 password /add /homedir:\users\%1 /scriptpath:login.bat /domain
net localgroup "" %1 /add
repeat for local groups
net group "" %1 /add /domain
repeat for global groups
xcopy \users emplate \users\%1 /e
nltest /sync /server:BDCname
repeat for all BDCs you might be authenticating to
sleep 20
cacls \users\%1 /e /r Everyone
remove the everyone permission to the directory
cacls \users\%1 /g %1:F /e
cacls \users\%1 /g Administrators:F /e

The nltest commands are needed as otherwise it fails to do the cacls command, since the user account does not exist on the BDC to which you are authenticating as only the PDC has been updated.
Posted by NTFAQ

트랙백 주소 :: http://ntfaq.co.kr/trackback/706 관련글 쓰기

댓글을 달아 주세요