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

0

本文介绍了如何在 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 属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14