Re: Polling 'last logged on' User Property in AD
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 11:33:02 -0500
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
--
.
- Follow-Ups:
- Re: Polling 'last logged on' User Property in AD
- From: ::Travis
- Re: Polling 'last logged on' User Property in AD
- References:
- Polling 'last logged on' User Property in AD
- From: ::Travis
- Polling 'last logged on' User Property in AD
- Prev by Date: Polling 'last logged on' User Property in AD
- Next by Date: Re: Polling 'last logged on' User Property in AD
- Previous by thread: Polling 'last logged on' User Property in AD
- Next by thread: Re: Polling 'last logged on' User Property in AD
- Index(es):
Relevant Pages
|