如何在 C# 中从 LDAP 读取 TermainsServices IADsTSUserEx 属性?

How to read TermainsServices IADsTSUserEx Property from LDAP in C#?(如何在 C# 中从 LDAP 读取 TermainsServices IADsTSUserEx 属性?)
本文介绍了如何在 C# 中从 LDAP 读取 TermainsServices IADsTSUserEx 属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 AD 中阅读了以下属性,

I have read the following properties from AD,

TerminalServicesProfilePath
TerminalServicesHomeDirectory
TerminalServicesHomeDrive

我已经尝试过 DirectoryEntry 和 DirectorySearcher.但它们不包括属性.

I've tried DirectoryEntry and DirectorySearcher. But they does not include the properties.

我在 vbscript 和 VC 中找到了一些示例来阅读它们.但是我未能使其在 C# 中工作.我错过了一些棘手的事情吗?

I found some example in vbscript and VC to read them. However I failed to make it working in C#. Am I missing some tricky thing?

我必须在Windows Server"上运行它才能使其工作吗?win XP 可以读取吗?

Am I have to run it on "Windows Server" to make it works? Can it be read from win XP?

推荐答案

具体记不太清了,大概是这样的:

I don't remember exactly, but it's something like this:

//user is a DirectoryEntry
IADsTSUserEx adsiUser = (IADsTSUserEx)user.NativeObject; 

然后您可以通过 adsiUser 获取所需的 TerminalServices 属性.

then you can get the TerminalServices properties you want via adsiUser.

根据我的经验,由于您使用的库,您最好在可以访问 AD 的 Windows Server 上进行开发.那么你可能也会完成上述工作:)

From my experience you're better off developing on a Windows Server with access to AD due to the libraries you use. Then you'll probably make the above work, too :)

这篇关于如何在 C# 中从 LDAP 读取 TermainsServices IADsTSUserEx 属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)