Recipe 15.8. Setting a Domain User s Profile Attributes

Recipe 15.8. Setting a Domain User's Profile Attributes


You want to set one or more of the profile attributes for a domain user account.


Using a graphical user interface

  1. Open the Active Directory Users and Computers snap-in (dsa.msc).

  2. In the left pane, right-click on the domain and select Find.

  3. Select the appropriate domain beside In.

  4. Beside Name, type the name of the user and click Find Now.

  5. In the Search Results, double-click on the user.

  6. Click the Profile tab.

  7. Modify the various profile settings as necessary.

  8. Click OK.

Using a command-line interface

Use the dsmod command to set the various profile attributes:

> dsmod user "<UserDN>" -loscr ScriptPath -profile ProfilePath -hmdir HomeDir -hmdrv DriveLetter

Using VBScript
' This code sets the various profile related attributes for a user. strUserDN = "<UserDN>"   ' e.g. cn=jsmith,cn=Users,dc=rallencorp,dc=com set objUser = GetObject("LDAP://" & strUserDN) objUser.Put "homeDirectory", "\\fileserver\" & objUser.Get("sAMAccountName") objUser.Put "homeDrive", "z:" objUser.Put "profilePath", "\\fileserver\" & _             objUser.Get("sAMAccountName") & "\profile" objUser.Put "scriptPath", "login.vbs" objUser.SetInfo Wscript.Echo "Profile info for " & objUser.Get("sAMAccountName") & " updated"


The four attributes that make up a user's profile settings in Active Directory include the following:


UNC path to home directory


drive letter (e.g. z:) to map home directory


UNC path to profile directory


path to logon script

When you set the homeDirectory attribute, the folder being referenced needs to already exist. For an example on creating shares for users, see MS KB 234746.

See Also

MS KB 234746 (How to Create User Shares for All Users in a Domain with ADSI), MS KB 271657 (Scripted Home Directory Paths Require That Folders Exist), and MS KB 320043 (HOW TO: Assign a Home Directory to a User)

Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: