Get last logon time,computer and username together with Powershell

I have a script which gets the last logon times of each computer in the domain.
My script:
$dcs = Get-ADComputer -Filter { OperatingSystem -NotLike '*Server*' } -Properties OperatingSystem
foreach($dc in $dcs) {
Get-ADComputer $dc.Name -Properties lastlogontimestamp |
Select-Object @{n="Computer";e={$_.Name}}, @{Name="Lastlogon"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}}
==================================
Result:
Computer Lastlogon
DC1 6/06/2013 16:38:24
DC2 6/06/2013 16:30:40
=============================================I also want to get who/which account made this logon. For example:Computer Lastlogon User
DC1 6/06/2013 16:38:24 user2
DC2 6/06/2013 16:30:40 user1

I also want to get who/which account made this logon. For example:Computer Lastlogon User
DC1 6/06/2013 16:38:24 user2
DC2 6/06/2013 16:30:40 user1
The last logon from aD is the last time the computer account authenticated on AD.  It has nothing to do with a user.
Get-ADComputer will not return DCs. It will return all workstations.
To find the last logon for a specific computer just query the computers security log for event 529(XM-2003) or 4672 Get the newest one.
¯\_(ツ)_/¯

Similar Messages

  • HT4901 By synching our computer and tablet together with our new iphone, we lost all our critical calendar data. How do we get it back?

    By synching our computer and tablet together with our new iphone, we lost all our critical calendar data. How do we get it back? The help info, HT4901, was the closest info from the Help pages but it assumed we were already on icloud and had simply disconnected our calendar from icloud. Actually, we were simply trying to synch our devices by signing up with icloud for the first time, so it seems our calendar never had a chance to get uploaded. In any case, how do you reconnect / re-access a calendar on icloud?

    If your calendar does not appear on icloud.com it never uploaded to iCloud.  If it is no longer on your computer you would have to restore it from a backup source such as Time Machine to restore it.

  • AD Users Last Logon Time

    Hi Folks,
    I need to generate User's Last logon time from AD database. Could any one please assist me on this.
    Thanks in advance !
    -Chalapathi

    Hi,
    Get-ADUser -Identity USERNAME -Properties LastLogonDate |
    Select SamAccountName, LastLogonDate
    Link to syntax:
    http://ss64.com/ps/get-aduser.html
    EDIT: Just in case:
    http://blogs.technet.com/b/askds/archive/2009/04/15/the-lastlogontimestamp-attribute-what-it-was-designed-for-and-how-it-works.aspx
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • USR02-LTIME - Last logon Time

    Hi All
    we have to trace the last logon time of CRM webclient users but USR02-LTIME does not write the right time, in this sense:
    - you logon at 11:00 with user TEST
    - you see USR02-LTIME = 11:00
    - you use the webclient without logoff and you see in USR02-LTIME the time of the last click
    Can you help me ?
    Regrads,
    Davide Ivanov
    Pirelli Italy

    1 .You can do it from NWA.
    http://fqdn:port/nwa
    analysis-debug-logs and traces,Initial check sap logs or default logs with predefined view
    Later open column customization and check mark "user"
    and you can get all informartion about user.
    Hope it help.
    Amit

  • Last Logon Time

    Hi,
     In Exchange 2003 I looked into the Mailboxes on a Mailbox Store. It has a label Last Logon Time. What is this last logon time? Where does it get it from? I have users already using another email system which is web based and they are no longer using
    outlook on their PCs.
    Thanks!

    Last Logon Time that is shown in Active Directory and Exchange are different. Active Directory shows last successful authentication and Exchange shows last time when mailbox was accessed. However, Exchange uses many background processes that access the
    mailbox for maintenance.
    - Sarvesh Goel - Enterprise Messaging Administrator

  • Last logon time from list of computers?

    Hello,
    I'm looking for some type of script that will query a list (c:\script\computers.txt) of computers and return the last logon date and user.
    I do not want to do this from active directory, but instead want to get the data directly from the machines. So to sum it up I need to input a list of host names (all on the network) and output a list of last logon time stamps.
    Any help is appreciated!
    Thank you,
    Brian

    Hi
    Well AD will be your best option but you can try this in a bat file:
    net user User| findstr /B /C:"Last logon"
    Hope this helps. Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • How to get Lion off my computer and go back to Snow Leopard???

    How do I get rid of Lion and go back to Snow Leopard PERMANENTLY?
    I am not techno.
    I need simple instructions with plain descriptions. I do not have any discs. The iMac came with Snow Leopard and I loaded NOTHING.
    I should never have bought  Lion. It is awful.
    Please someone tell me how to get Lion off my computer and go back to Snow Leopard.

    Can I use time machine to restart the machine before the fateful day when I bought and installed Lion?
    Yes, if you have a pre-Lion backup, but you need an installation disc.
    Is there anything else I can do?  more RAM?
    I don't know how much RAM you have. It must be at least 2 GB, or Lion wouldn't have installed. If that's all you have, you might get better performance by adding more. But from your description, I doubt that your problem is due entirely, if at all, to a lack of RAM. If you want to troubleshoot the problem, it will take some patience and effort, and you'll need to be in a calm frame of mind.

  • Get last logon + user name

    Hi Everyone 
    first on all where is the powershell forum ?
    I need help with powershell,
    we have file ( Excel -CSV )  that contains names of 70  computers name ,
    I want to know which user did logon and  who is now is login.
    NOTE :
    I succeed to get the last login but I do not know which user did logon
    I will happy if someone help me , thank you and i appreciate you
    My Website:www.Pelegit.co.il Mcitp /Mcsa 2012

    Hi Meir,
    >>Get last logon + user name
    Regarding this question, the following thread can be referred to for more information.
    How to display last login user account in active directory ?
    https://social.technet.microsoft.com/Forums/en-US/8609ce4d-b15f-447b-bc37-142021b9e00c/how-to-display-last-login-user-account-in-active-directory-?forum=winserverDS
    >>first on all where is the powershell forum ?
    Windows PowerShell
    https://social.technet.microsoft.com/Forums/Windows/en-US/home?forum=winserverpowershell
    Best regards,
    Frank Shen
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Last Logon Time in Iplanet Directory Server 4.1

    Hi,
    It would be great help if any one of you could let me know the attribute in Iplanet Directory Server 4.1 to get the Last Logon Time of a particular account.
    The Directory Server is on solaris.
    Thanks

    Hari,
    You can try to find it from the logfiles.
    I actually designed a plugin for this type of thing, but it's not yet implemented. It would simply write a timestamp to a user's entry after every successful bind, among other things which I won't go into detail about now...
    Oletko suomessa?
    podzap

  • HT201272 I just updated to itunes 10.3 & iOS 6.1 and I cannot download a song to my library! I get the error "This computer is already associated with an Apple ID. You can download past purchases on the computer with just one apple ID every 90 days..." WH

    I just updated to itunes 10.3 & iOS 6.1 and I cannot download a song to my library! I get the error "This computer is already associated with an Apple ID. You can download past purchases on the computer with just one apple ID every 90 days. This computer can be used with a different Apple ID in 75 days." WHAT??
    I've never had problems before - my husband and I have used the same library for years.  My daughter also has her own Apple ID... are we going to have trouble with that, too?  Actually we have 4 Apple IDs - somewhere around 8 Apple devices... this is a huge issue for us... HELP

    Just to be clear - I just bought a new song and can't download it into the library because of this error message.

  • I brought up my itunes through a friends laptop. I signed out thinking I could get on my home computer and still have my iTunes accessible, how do i access them from this computer? HELP

    I brought up my itunes through a friends laptop. I signed out thinking I could get on my home computer and still have my iTunes accessible, how do i access them from this computer? HELP

    Copy everything from the old computer or your backup copy of your old computer, to your new one.

  • HT1373 So i bought music on a different computer but oAn the same itunes account and on the same ipod and when i get on my original computer and i sync my ipod my purchases that were on the other computer didnt show up. How can i put them on my computer/i

    So i bought music on a different computer but oAn the same itunes account and on the same ipod and when i get on my original computer and i sync my ipod my purchases that were on the other computer didnt show up. How can i put them on my computer/ipod

    Download them to the computer to which the iPod is synced, re-sync.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store - http://support.apple.com/kb/ht2519 - enabled with iTunes 10.3 and newer; not available in all countries; apps, books (not audiobooks), music, t.v. shows, and movies (some - not all studios have permitted this). Movies currently available in the USA only. Downloading previously purchased movies and TV shows requires iTunes 10.6 or later.  Discontinued items not available. For items not included in the iCloud list, or locations or computer systems where iCloud is not (yet?) available, you only get one download per fee paid.  Apple notes it is your responsibility to back up your purchases.
    Select the store on the left side of iTunes.
    Click on Purchased on the right side under Quick Links.
    You can re-download your available previous purchases.

  • If I have a movie on my mac on iTunes how do i get it off my computer and into the iCloud?

    f I have a movie on my mac on iTunes how do i get it off my computer and into the iCloud?

    You don't need to manually put iTunes Store purchases in the cloud. If that purchase can be stored there in your country, it's done so upon purchase. If not, it isn't possible.
    (84039)

  • HT1386 I sync all songs, photos and videos between my computer and iPod classic with no problems, but when I get to sync info I get this message: "iTunes cannot sync Calendar and contacts to iPod. Try logging out of Windows adn then logging back in".

    I sync all songs, photos and videos between my computer and iPod classic with no problems, but when I get to sync info I get this message: "iTunes cannot sync Calendar and contacts to iPod. Try logging out of Windows adn then logging back in".  Could you please help?

    Correct. When you update via iTunes all synced media that is not in your iTunes library will be lost.
    As IO said before:
    You can redownload most iTunes pruchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    I do not think it included audio books.

  • HT1430 I got my FIRST APPLE, iPhone 5S, about 80 days ago. on the 3-4 last charges, I found that restarts in last percents of charging process. On last charge time, restarted and remained off. It is grubby apple :-(( there's no troubleshooting for it?!

    I got my FIRST APPLE, iPhone 5S, about 80 days ago. on the 3-4 times of last battery charges, I found that restarts in last percents of charging process. On the last charge time, restarted and remained off. It is grubby apple :-(( there's no troubleshooting for it?!
    my iPhone 5s does not turn on at all , so I can't reset as it is recommended here in support... iTunes message that is in recovery mode... gives Error 40

    Hold down the Power and Home buttons at the same time for about 10 seconds, or until the Apple logo appears. That forces it into a reboot. If that doesn't work, contact Apple for warranty replacement.

Maybe you are looking for