简体   繁体   English

如何使用C#在Windows Server 2003 Active Directory中设置TerminalServiceProfile路径?

[英]How to set TerminalServiceProfile Path in Windows server 2003 Active Directory using C#?

I know in Windows 2008 AD, we have msTsProfilePath AD attribute using which we can directly set the terminal service profile path. 我知道在Windows 2008 AD中,我们具有msTsProfilePath AD属性,我们可以使用该属性直接设置终端服务配置文件路径。

But we have windows 2003 AD and i need to set terminal service profile path using C#. 但是我们有Windows 2003 AD,我需要使用C#设置终端服务配置文件路径。 I came across following article and have come to know from some other articles that terminal service profile path gets stored in userParameters property. 我遇到了以下文章,并从其他一些文章中了解到终端服务配置文件路径存储在userParameters属性中。

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

Can somebody tell me how to set CtxWFProfilePath in userParameters through C# ? 有人可以告诉我如何通过C#在userParameters中设置CtxWFProfilePath吗?


Thanks, 谢谢,
Nikhil. 尼基尔

Update: 更新:
Please refer to this MSDN forum where this gentleman "Konrad Neitzel" directed me to some useful links. 请访问此MSDN论坛 ,该先生“ Konrad Neitzel”将我引向一些有用的链接。 But as mentioned in the thread, i am finding difficulties in using WTSSetUserConfig method. 但是正如线程中提到的那样,我在使用WTSSetUserConfig方法时发现了困难。 Any idea ? 任何的想法 ?

I battled with this one too but finally was able to put together a working solution from dozens of different sites. 我也曾与之抗争,但最终能够将来自数十个不同站点的有效解决方案整合在一起。 I'm not sure is this exactly what you are needing but hopefully it helps 我不确定这是否正是您所需要的,但希望能有所帮助

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();

You can find all the attributes from this site (another tough thign to find out) http://www.virtualizationadmin.com/articles-tutorials/terminal-services/scripting/scripting-server-based-computing-terminal-services-attributes-active-directory-user-objects.html 您可以从该站点找到所有属性(另一个很难找到的属性) http://www.virtualizationadmin.com/articles-tutorials/terminal-services/scripting/scripting-server-based-computing-terminal-services-attributes -active-directory-user-objects.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在C#中检测Active Directory路径 - How to detect Active Directory path in c# 使用C#向Windows Server 2003/2008中的防火墙添加例外 - Adding exception to firewall in Windows Server 2003/2008 using C# 如何使用C#设置Active Directory的密码有效期限 - How to set password expiry date of Active Directory using C# 如何使用C#以编程方式向Active Directory中的用户设置电子邮件 - How to set email to a user in Active Directory programatically using c# 使用C#在Windows Server 2003上查询EventLog - Query EventLog on Windows Server 2003 using C# Windows Server 2003上的C#SocketAsyncEventArgs问题 - C# SocketAsyncEventArgs Issue on Windows Server 2003 如何使用C#/ Vb.Net在Windows Server 2003及更高版本上“删除-保护”文件或文件夹? - How to **delete-protect** a file or folder on Windows Server 2003 and onwards using C#/Vb.Net? Windows Azure ACS与Windows Active Directory(2003) - Windows Azure ACS with Windows Active Directory (2003) 如何使用目录服务(C#)在Active Directory中设置gecos属性 - How to set gecos attribute in Active Directory using directory services(C#) 使用C#在Windows Active Directory中通过Lastknownparent获取已删除的用户 - Getting deleted users by lastknownparent in windows active directory using c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM