0

我知道在 Windows 2008 AD 中,我们有 msTsProfilePath AD 属性,使用它我们可以直接设置终端服务配置文件路径。

但是我们有 Windows 2003 AD,我需要使用 C# 设置终端服务配置文件路径。我遇到了以下文章,并从其他一些文章中了解到终端服务配置文件路径存储在 userParameters 属性中。

http://www.selfadsi.org/user-attributes-w2k3.htm#List

有人可以告诉我如何通过 C# 在 userParameters 中设置 CtxWFProfilePath 吗?


谢谢,
尼基尔。

更新:
请参考这个MSDN 论坛,这位绅士“Konrad Neitzel”向我介绍了一些有用的链接。但正如线程中提到的,我发现使用 WTSSetUserConfig 方法有困难。任何想法 ?

4

1 回答 1

0

我也与这个进行了斗争,但最终能够从数十个不同的站点组合出一个可行的解决方案。我不确定这是否正是您所需要的,但希望对您有所帮助

PrincipalContext domainContext = new PrincipalContext(ContextType.Domain, "name", "container");
UserPrincipals user = UserPrincipals.FindByIdentity(domainContext, "ad_user_name");

DirectoryEntry dirEntry = (user.GetUnderlyingObject() as DirectoryEntry);
dirEntry.InvokeSet("TerminalServicesProfilePath", "yourpath");

dirEntry.CommitChanges();

你可以从这个站点找到所有属性(另一个很难找到) http://www.virtualizationadmin.com/articles-tutorials/terminal-services/scripting/scripting-server-based-computing-terminal-services-attributes -active-directory-user-objects.html

于 2014-10-08T06:00:14.073 回答