header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Get list of users who have not logged in for X days
Last Post 30 Jul 2010 02:14 AM by aleksandar. 3 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
dmxopUser is Offline
New Member
New Member
Posts:9
Avatar

--
27 Jul 2010 10:19 AM
    Hello,

    I am trying to get a list of users who have not logged in for a number of days using the lastlogontimestamp attribute.  I have the following but it does not return back anything, can anyone help!

    $now=get-date
    $daysSinceLastLogon=10
     
    Get-QADUser -sizeLimit 0 | where {$_.lastlogontimestamp.value -and (($now-$_.lastlogontimestamp.value).days -gt $daysSinceLastLogon)}

    Thanks
    Tony
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    28 Jul 2010 11:31 PM
    Try this, it requires the latest version of QAD cmdlets (1.4):

    Get-QADUser -NotLoggedOnFor 10 -SizeLimit 0

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    dmxopUser is Offline
    New Member
    New Member
    Posts:9
    Avatar

    --
    29 Jul 2010 10:48 PM
    Excellent - that worked great.

    Many Thanks
    Tony
    aleksandarUser is Offline
    New Member
    New Member
    Posts:54
    Avatar

    --
    30 Jul 2010 02:14 AM
    http://dmitrysotnikov.wordpress.com...computers/

    NotLoggedOnFor – to specify the number of days since last time the account was used to log on (note that LastLogonTimestamp parameter is used, which means that it is replicated between DCs and the retrieval is fast and works with any domain controller, but it requires 2003 or later AD schema and is only replicated every 9-14 days (so please don’t specify values less than 14)

    Follow me on Twitter: http://twitter.com/alexandair
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer