如何在C#LDAP读TermainsServices IADsTSUserEx房产吗? [英] How to read TermainsServices IADsTSUserEx Property from LDAP in C#?
问题描述
我已经阅读从公元以下属性,
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.
从我的经验,你最好开发Windows服务器能够访问AD上,由于您使用的库。然后,你可能会做上述工作,太:)
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房产吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!