如何在 Windows Server 2003 中自动配置新创建的域用户的漫游配置文件路径?

如何在 Windows Server 2003 中自动配置新创建的域用户的漫游配置文件路径?

如何设置 Windows Server 2003 以默认为新创建的域用户配置漫游配置文件路径?

假设我将漫游配置文件存储在路径 \server\profiles 中。是否有一些密钥或策略可以将默认配置文件路径设置为如下内容:

\服务器\配置文件\$用户名

我无需记住手动配置每个新创建用户的配置文件路径?

答案1

对于较旧的系统Windows XP/2003你可以创建一对模板帐户只需复制模板即可。复制帐户时,许多字段将以复制的值开头。在模板中使用以下变量%用户名%而不是用户名。

另一个选择是使用 Powershell 或 vbscript 编写帐户创建脚本。查看周围有许多很好的脚本示例,这些脚本会将帐户添加到目录并设置大多数选项。

为了Vista/Windows 2008计算机。如果配置文件将在其上漫游的计算机位于您可以应用组策略的 OU 或组中,那么您可以为每台计算机设置漫游配置文件路径。

打开您的组策略编辑器并转到此处。

Computer Configuration \ Administrative Templates \ System/User Profiles \ Set roaming profile path for all users on this computer.

答案2

如果您使用像 dsadd.exe 这样的命令行工具,那么您可以为用户名字段指定通用变量。

C:\tools>dsadd user /?
Description:  Adds a user to the directory.
Syntax:  dsadd user <UserDN> [-samid <SAMName>] [-upn <UPN>] [-fn <FirstName>]
        [-mi <Initial>] [-ln <LastName>] [-display <DisplayName>]
        [-empid <EmployeeID>] [-pwd {<Password> | *}] [-desc <Description>]
        [-memberof <Group ...>] [-office <Office>] [-tel <Phone#>]
        [-email <Email>] [-hometel <HomePhone#>] [-pager <Pager#>]
        [-mobile <CellPhone#>] [-fax <Fax#>] [-iptel <IPPhone#>]
        [-webpg <WebPage>] [-title <Title>] [-dept <Department>]
        [-company <Company>] [-mgr <Manager>] [-hmdir <HomeDir>]
        [-hmdrv <DriveLtr:>] [-profile <ProfilePath>] [-loscr <ScriptPath>]
        [-mustchpwd {yes | no}] [-canchpwd {yes | no}]
        [-reversiblepwd {yes | no}] [-pwdneverexpires {yes | no}]
        [-acctexpires <NumDays>] [-disabled {yes | no}]
        [{-s <Server> | -d <Domain>}] [-u <UserName>]
        [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters:

Value                   Description
<UserDN>                Required. Distinguished name (DN) of user to add.
                        If the target object is omitted, it will be taken
                        from standard input (stdin).
-samid <SAMName>        Set the SAM account name of user to <SAMName>.
                        If not specified, dsadd will attempt
                        to create SAM account name using up to
                        the first 20 characters from the
                        common name (CN) value of <UserDN>.
-upn <UPN>              Set the upn value to <UPN>.
-fn <FirstName>         Set user first name to <FirstName>.
-mi <Initial>           Set user middle initial to <Initial>.
-ln <LastName>          Set user last name to <LastName>.
-display <DisplayName>  Set user display name to <DisplayName>.
-empid <EmployeeID>     Set user employee ID to <EmployeeID>.
-pwd {<Password> | *}   Set user password to <Password>. If *, then you are
                        prompted for a password.
-desc <Description>     Set user description to <Description>.
-memberof <Group ...>   Make user a member of one or more groups <Group ...>
-office <Office>        Set user office location to <Office>.
-tel <Phone#>           Set user telephone# to <Phone#>.
-email <Email>          Set user e-mail address to <Email>.
-hometel <HomePhone#>   Set user home phone# to <HomePhone#>.
-pager <Pager#>         Set user pager# to <Pager#>.
-mobile <CellPhone#>    Set user mobile# to <CellPhone#>.
-fax <Fax#>             Set user fax# to <Fax#>.
-iptel <IPPhone#>       Set user IP phone# to <IPPhone#>.
-webpg <WebPage>        Set user web page URL to <WebPage>.
-title <Title>          Set user title to <Title>.
-dept <Department>      Set user department to <Department>.
-company <Company>      Set user company info to <Company>.
-mgr <Manager>          Set user's manager to <Manager> (format is DN).
-hmdir <HomeDir>        Set user home directory to <HomeDir>. If this is
                        UNC path, then a drive letter that will be mapped to
                        this path must also be specified through -hmdrv.
-hmdrv <DriveLtr:>      Set user home drive letter to <DriveLtr:>

特殊标记$用户名$(不区分大小写)可用于将 SAM 帐户名称放入参数值中。例如,如果目标用户 DN 为 CN=Jane Doe,CN=users,CN=microsoft,CN=com 且 SAM 帐户名称属性为“janed”,则 -hmdir 参数可以进行以下替换:

-hmdir \users\$用户名$\home

相关内容