locked
help me thanks all , about create accounts and home folder RRS feed

  • 問題

  •    I have a VBScript to add users to AD using a .csv file for input.  I want to add a Home Drive and Directory to the profile.  I have the directory as '\\server\users\%username%" .  When I process the script the profile shows the "\\server\users\%username%' as the home directory, but it hasn't been applied to translate the %username% or create the folder.  However, if I manually apply the change, it does create the folder correctly. 
    Is there a way to create the folder when the user is added, or do I need to create the folder and assign permissions as a sparate step in the script?

     

    Command : for /f "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13 delims=," %a in (a.csv) do dsadd user cn=%c,ou=finance,ou=users,ou=sc,ou=sh,ou=cn,dc=sc,dc=sh,dc=cn, -samid %d -fn %a -ln %b -pwd %e -disabled no -canchpwd yes -mustchpwd yes -loscr %f -hmdrv %g -hmdir %h -display %i -office %j -tel %k -email %l -webpg %m

     

    a.csv file location C:\

     

     

    2008年9月11日 上午 07:38

解答

  • This isn't an error, it is by design.  All you are doing is setting the attribute in question.  You must create the folder and share, if necessary yourself.  ADUC does this for you.  But that's ADUC, not LDAP.  The operation you are performing using DSADD is LDAP, albeit sometimes encrypted.

    Anyway, if you use ADMOD, I think you'd need to set both homeDrive and homeDirectory.

    As an example, the following will create a user and set the home drive and home folder attributes in addition to the mandatory attributes and one or two other attributes:

    admod -add -b "CN=ABC,OU=People,DC=longhorn,DC=com" objectClass::user sAMAccountName::ABC userPrincipalName::ABC@longhorn.com givenName::ABC sn::ABC
    displayName::"ABC" homeDrive::H: homeDirectory::\\FileServer\home$\ABC unicodePwd:Stick out tongue@ssw0rd -kerbenc
    2008年9月25日 上午 10:21