Re: Polling 'last logged on' User Property in AD



Travis wrote:

Hey I was just wondering if anyone had the powershell syntax for being
able
to poll the 'last logged on' property of a user account in AD?

The script repository seems have everything except for this.

This attribute probably is not covered because it is not replicated. For
each user a different value is saved on every DC in the domain. You must
query every DC in the domain and retain the largest (latest) value. Plus,
you must convert the Integer8 (64-bit) value into a date/time in the local
time zone.

You probably should query for lastLogonTimeStamp. This attribute is
available if the domain is at Windows Server 2003 functional level. This
attribute is only updated during logon if the old value is more than 14 days
old (by default), but then the value is replicated. You need only query one
DC. The syntax would be identical to that used for the pwdLastSet attribute,
which is another Integer8 attribute that is replicated. The value of
lastLogonTimeStamp will not be accurate unless it is at least 14 days in the
past, but that should meet the needs of most people.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


.



Relevant Pages

  • Re: how to setup login and account creation?
    ... You cannot use the popup to query anything. ... You can use ASP to manage permissions and to call system libraries to ... > if i can creat user account or groups, the way is been created right on ... > windows server, through browser.. ...
    (microsoft.public.inetserver.iis)
  • Re: LDAP
    ... special account at all as you don't have to query anything. ... > setup the connection between my AIX server and AD. ... I know I need to setup a user account to ...
    (microsoft.public.windows.server.active_directory)
  • RE: Connect to a Secure Win2K LDAP server from Windows 2003
    ... This is probably because by default the normal user account does not have ... and Read all properties and Read all permissions for group and user ... Secure LDAP itself is I ... > connect to and query the information on the secure LDAP. ...
    (microsoft.public.windows.server.active_directory)
  • Re: HOW TO Assign wmi rights to non-administrators!
    ... This query runs only with the administrator account, ... > The action should work locally as a regular user account. ... > If you are doing this on a remote computer, ... > Microsoft MVP - Windows Server Management Infrastructure ...
    (microsoft.public.win32.programmer.wmi)