C# 从Active Directory获取配置文件路径和主文件夹

C# 从Active Directory获取配置文件路径和主文件夹,c#,active-directory,C#,Active Directory,我使用的是C#,我能够从Active Directory中读取很多值,但是我不知道如何读取配置文件路径或远程桌面服务主文件夹,在查看Active Directory中的用户时,这两个文件夹都位于“远程桌面服务配置文件”选项卡上 这些值存储在UserParameters属性中,要获取它们,您可以在此处使用InvokeGet,例如获取远程服务配置文件路径: // Get Directory Entry for the object DirectoryEntry de = New DirectoryE

我使用的是C#,我能够从Active Directory中读取很多值,但是我不知道如何读取配置文件路径或远程桌面服务主文件夹,在查看Active Directory中的用户时,这两个文件夹都位于“远程桌面服务配置文件”选项卡上

这些值存储在UserParameters属性中,要获取它们,您可以在此处使用InvokeGet,例如获取远程服务配置文件路径:

// Get Directory Entry for the object
DirectoryEntry de = New DirectoryEntry(ldapPath, logonName, password);
object prPAth = de.InvokeGet("TerminalServicesProfilePath"); // Remote Desktop Services profile path. If value is empty you'll get an exception here
object homeFolder = de.InvokeGet("TerminalServicesHomeDirectory"); // Remote Desktop Services home folder

什么服务器操作系统?配置文件路径应该只是“profilePath”属性。我猜另一个应该是远程桌面服务主文件夹,在Server 2003中查找TerminalServicesHomeDrive、TerminalServicesHomeDirectory和TerminalServicesProfilePath,在Server 2008中查找MstHomeDrive、MstHomeDirectory和MstProfilePath。我使用的是Windows Server 2008。你是对的第二个值应该是远程桌面服务主文件夹,我已经更新了我的帖子以修复输入错误。我已经检查了你建议的所有值,并且所有值都为空。尝试在调试器中使用此代码,它不是近乎完美的,但将帮助你查看该条目上的属性。Dictionary DictionaryOfValues=directoryEntry.Properties.OfType().ToDictionary(p=>p.PropertyName,p=>(p.Value???).ToString());我接受了你的建议,并使用该代码查看所有属性。您建议的值未列出,也未列出类似的值。我想要的值是否可能在“UserParameters”属性中?这是我唯一看不懂的属性,它是如何编码的,我不知道如何解码。