我如何在.NET改变AD用户的远程桌面服务属性? [英] How do I change Remote Desktop Services properties of AD users in .NET?

查看:143
本文介绍了我如何在.NET改变AD用户的远程桌面服务属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要配置.NET相关的远程桌面服务上的Active Directory用户属性(例如,通过System.DirectoryServices中),但我不能看到这些属性是由API公开?我知道有这个目的,IADsTSUserEx一个COM接口。请告诉我,我怎么能在.NET :)熊这些属性得到记住,编程语言是Python的。

I need to set properties related to Remote Desktop Services on Active Directory users in .NET (i.e., via System.DirectoryServices), but I can't see that these properties are exposed by the API? I know there is a COM interface for this purpose, IADsTSUserEx. Please show me how I can get at these properties in .NET :) Bear in mind that the programming language is Python.

推荐答案

与这些性质的问题是,你可以看到他们通过Active Directory用户和计算机的用户界面,但不能设置它们(或看到他们)通过ADSI编辑器。

The problem with some of these properties is that you can see them on the UI via Active Directory Users and Computers, but you cannot set them (or see them) via ADSI Editor.

通常情况下,不直接从一个的DirectoryEntry 对象属性,你可以使用它的属性集合所描述的添Robbinson (例如: directoryEntry.Properties [属性名。值)。

Usually, for properties that aren't directly available from a DirectoryEntry object, you can use its Properties collection as described by Tim Robbinson (e.g. directoryEntry.Properties["PropertyName"].Value).

对于某些属性,但是,你不能使用这种方式,必须使用 directoryEntry.InvokeSet(属性名,新的对象[] {someValue中});

For some properties, however, you cannot use this approach and have to use directoryEntry.InvokeSet("PropertyName", new object[]{ "SomeValue" });,

例如。为 TerminalServicesHomeDirectory TerminalServicesHomeDrive TerminalServicesProfilePath

正如上面所说的,你不会看到使用ADSI编辑器这三个属性,你只能通过相应的选项卡上的正常的用户界面看到的属性值。

As said above, you won't see these three properties using ADSI Editor, you can only see the property values via the "normal" UI on the corresponding tab.

您如何应用这一切到Python我不知道,但似乎你已经得到了的DirectoryEntry 类的实例,所以你应该罚款。

How you can apply all this to Python I don't know, but it seems you've got instances of the DirectoryEntry class, so you should be fine.

这篇关于我如何在.NET改变AD用户的远程桌面服务属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆