0

I am new to .net. I have a requirement that whenever employee switch on(log on) his computer I want to capture that time and whenever user shut down his system again I want to capture that particular time through Active Directory i.e I want to capture both login and logout time of particular PC using Active directory using C#. Is it possible? Here I should read this information (login and logout time of PC) from Active Directory only.

Please assist me.

4

1 回答 1

0

用户和计算机具有 lastLogon 和 lastLogoff 属性,但它们不会在域控制器之间复制,因此您需要查询所有 DC。lastLogoff 似乎也没有被填充......

您可以执行以下任何操作:

  1. 为客户端 PC 创建服务以监视这些事件并将它们写入数据库。
  2. 使用启动和关闭脚本创建 GPO 以记录这些事件。
  3. 监控 DNS / DHCP 的请求和发布

可以在此处此处找到有关启动和关闭脚本的信息。

您可能有一个执行以下操作的 CMD 启动脚本:

echo %Computername% 从 %Date% - %Time% >> \\Server\NULLSHARE\%Computername%.log

并在关闭脚本中:

echo %Computername% 在 %Date% - %Time% >> \\Server\NULLSHARE\%Computername%.log 关闭

于 2012-11-23T10:36:05.627 回答