Active directory 设置远程桌面服务配置文件和主目录路径Windows 2008

Active directory 设置远程桌面服务配置文件和主目录路径Windows 2008,active-directory,windows-server-2008-r2,profile,drive,home-directory,Active Directory,Windows Server 2008 R2,Profile,Drive,Home Directory,我正在尝试以编程方式为Windows 2008 R2 Acitve Directly中的远程桌面服务(终端服务)设置用户漫游配置文件路径。我可以在Windows 2003中使用vbscript或powershell,使用与下面列出的代码类似的代码,而不会出现任何问题 objUser.TerminalServicesProfilePath = "\\testing\test\"& profilename objUser.TerminalServicesHomeDirectory = \\t

我正在尝试以编程方式为Windows 2008 R2 Acitve Directly中的远程桌面服务(终端服务)设置用户漫游配置文件路径。我可以在Windows 2003中使用vbscript或powershell,使用与下面列出的代码类似的代码,而不会出现任何问题

objUser.TerminalServicesProfilePath = "\\testing\test\"& profilename
objUser.TerminalServicesHomeDirectory = \\testing\test\& username
objUser.TerminalServicesHomeDrive = "Y:"
objUser.AllowLogon = Enabled
objUser.SetInfo
我发现广告对象名称在2008 R2中发生了变化,并更新了我的代码以反映类似这样的变化

objUser.msTSProfilePath = "\\testing\test\"& profilename
objUser.msTSHomeDirectory = "\\testing\test\"& username
objUser.msTSHomeDrive = "Y:"
objUser.AllowLogon = Enabled
objUser.SetInfo
问题是,虽然这段代码更新了users AD对象(我使用ADSIEDIT进行了验证),但设置从未在Active Directory用户和计算机中显示,而且当用户登录到远程桌面会话时,设置也不起作用