捕获 ActiveDirectory“addUser” C# 中的事件?

发布于 2024-12-13 14:05:10 字数 365 浏览 1 评论 0原文

我们的系统具有“自动登录”功能。

因此,如果我在 AD 中创建一个新用户“John”,那么 John 就能够访问 Intranet 网站(我们查询 AD 以查看当前用户是否在 AD 中)。

但是

我们还有一个users表(SQL Server),它需要有新用户的FirstNameLastName用户。

每次在 AD 中创建新用户时,我们希望更新Users 表 - 应运行一些 C# 代码将相关数据输入 SQL Server(以及其他一些内容)。

我怎样才能捕获“AD 中的新用户已创建”事件?

We have the ability of "AutoLogin" in our systems.

So if I create a new user in AD as "John" - then John has the ability to access the intranet web site ( we query AD to see if the current user is in AD).

But

We also have a users table (SQL Server) which needs to have the FirstName and LastName of the new user.

We want to update that Users table each time a new user in AD is created - some C# code should be run to enter the relevant data into SQL Server (and some other things).

HOw can I catch the event of "new user in AD created" ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

戏蝶舞 2024-12-20 14:05:10

查看 Ryan Dunn 的精彩博客文章:

在 .NET 中实现更改通知

,该文章涉及这个主题。他提供了三个选项:

  • 使用 uSNChanged
  • DirSync 控件
  • 轮询更改 使用Active Directory 中的

更改通知轮询更改,并显示了每个选项的优缺点,以及第三个选项(更改通知)的一些 C# 代码。

Check out Ryan Dunn's excellent blog post:

Implementing Change Notifications in .NET

that deals with this exact topic. He offers three options:

  • Polling for Changes using uSNChanged
  • Polling for Changes Using the DirSync Control
  • Change Notifications in Active Directory

and shows pros and cons for each of the options, and some C# code for the third option (Change Notifications).

五里雾 2024-12-20 14:05:10

您可以使用 C# 中的 System.DirectoryServices.Protocols.DirectoryNotificationControl 来实现此目的,这样您就不必轮询 AD 的更改。

WMI 可能是您可以深入研究的第二个解决方案。它存在 AD WMI 提供程序。 使用WMI监控AD给你一些线索。本文所做的内容并没有超出您到目前为止所了解的内容,但我认为使用 WMI 事件您可以创建所需的通知。您可以在监控 Active Directory 运行状况中找到有关此内容的 Microsoft 信息,< a href="http://technet.microsoft.com/en-us/library/cc180914.aspx" rel="nofollow">特殊的 Active Directory WMI 提供程序。

You can use System.DirectoryServices.Protocols.DirectoryNotificationControl from C# for this purpose so you don't have to poll AD for changes.

WMI is perhaps a second solution you can dig in.It exists AD WMI Providers. Using WMI to Monitor AD gives you some clues about that. This article don't do more than what you get so far, but I think that with WMI events you can create the notifications you need. You can find Microsoft informations about this begining in Monitoring Active Directory Health, especialy Active Directory WMI Providers.

离笑几人歌 2024-12-20 14:05:10

如果不将添加新用户的实际函数包装到某种 C# 例程中,您不太可能捕获此类事件。如果您沿着这条路线走下去,您可以同时将所使用的添加到 AD 和 mysql。

另一种选择是轮询 AD 用户并对照现有 mysql 用户进行检查,并在找到时添加新用户。

It is unlikely that you can capture that kind of event without wrapping the actual function of adding the new user into some kind of c# routine. If you go down this route, you can add the used to AD and mysql at the same time.

Another option would be to poll the AD users and check this against the existing mysql users and add new when found.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文