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 ie 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.
There are the attributes lastLogon and lastLogoff for users and computers, but they are not replicated between domain controllers, so you would need to query all DCs. Also lastLogoff does not seem to be populated...
Your could do any of the following:
Information to Startup and Shutdown scripts can be found here and here .
You might have a CMD startup script that does something like this:
echo %Computername% starting at %Date% - %Time% >> \\\\Server\\NULLSHARE\\%Computername%.log
and in a shutdown script:
echo %Computername% shutting down at %Date% - %Time% >> \\\\Server\\NULLSHARE\\%Computername%.log
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.