English 中文(简体)
我怎样才能在.NET中更改AD用户的远程桌面服务属性?
原标题:How do I change Remote Desktop Services properties of AD users in .NET?

我需要在 .NET 中设置与远程桌面服务有关的属性,对于Active Directory 用户(即通过System.DirectoryServices),但我看不到API公开了这些属性。我知道有一个COM接口用于此目的,即IADsTsUserEx。请告诉我如何在.NET中访问这些属性:)请记住编程语言是Python。

问题回答

.NET DirectoryServices API无法直接公开AD属性:相反,DirectoryEntry类上有一个大的Properties集合。如果您可以找出底层AD模式中属性的名称,则可以在此集合中找到它们。

这个列表应该拥有你感兴趣的属性:http://msdn.microsoft.com/en-us/library/ms675090.aspx

例如,msTSMaxIdleTime属性:http://msdn.microsoft.com/en-us/library/ms678175.aspx

这些属性的问题是,虽然您可以通过Active Directory用户和计算机界面看到它们,但您无法通过ADSI编辑器设置它们(或查看它们)。

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("属性名", new object[]{"某个值"});

例如,对于 TerminalServicesHomeDirectoryTerminalServicesHomeDriveTerminalServicesProfilePath

如上所述,你利用自动财产调查编辑获得这三种财产,你只能通过相应的表格“正常”不动产估价。

我不知道你如何将所有这些应用于Python,但似乎你已经有了DirectoryEntry类的实例,所以应该没问题。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签