ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Get User Last Login from Windows

    Scheduled Pinned Locked Moved IT Discussion
    windowscommand lineclinet user
    18 Posts 8 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NerdyDadN
      NerdyDad @black3dynamite
      last edited by

      @black3dynamite What would the PowerShell alternative be?

      DustinB3403D 1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403 @NerdyDad
        last edited by

        @nerdydad Get-ADUser -Identity “username” -Properties “LastLogonDate”

        coliverC scottalanmillerS 2 Replies Last reply Reply Quote 1
        • coliverC
          coliver @DustinB3403
          last edited by

          @dustinb3403 said in Get User Last Login from Windows:

          @nerdydad Get-ADUser -Identity “username” -Properties “LastLogonDate”

          I don't believe that works for local users?

          black3dynamiteB DustinB3403D 2 Replies Last reply Reply Quote 0
          • black3dynamiteB
            black3dynamite @coliver
            last edited by

            @coliver said in Get User Last Login from Windows:

            @dustinb3403 said in Get User Last Login from Windows:

            @nerdydad Get-ADUser -Identity “username” -Properties “LastLogonDate”

            I don't believe that works for local users?

            Get-LocalUser

            1 Reply Last reply Reply Quote 1
            • DustinB3403D
              DustinB3403 @coliver
              last edited by

              @coliver, correct its AD only.

              1 Reply Last reply Reply Quote 0
              • black3dynamiteB
                black3dynamite
                last edited by

                You have to be using PowerShell 5.1 and up.

                1 Reply Last reply Reply Quote 1
                • jmooreJ
                  jmoore
                  last edited by

                  Never needed this information before but I will add it to my list of one-liners to use if I ever need to.

                  1 Reply Last reply Reply Quote 2
                  • scottalanmillerS
                    scottalanmiller @DustinB3403
                    last edited by

                    @dustinb3403 said in Get User Last Login from Windows:

                    @nerdydad Get-ADUser -Identity “username” -Properties “LastLogonDate”

                    Not using AD here.

                    1 Reply Last reply Reply Quote 0
                    • PhlipElderP
                      PhlipElder @scottalanmiller
                      last edited by PhlipElder

                      @scottalanmiller We use this script to check user activities as we're not always updated when users are gone in high churn environments among other uses:

                      Mohamed Garrana's script here:
                      https://social.technet.microsoft.com/Forums/en-US/216fe6ec-84de-4516-9110-12cc0a7ea9b0/is-there-a-way-to-add-the-last-login-timedate-in-ad-to-an-excel-column

                      EDIT: Just saw the lack of AD. Peer-to-peer makes this a challenge.

                      1 Reply Last reply Reply Quote 2
                      • dbeatoD
                        dbeato
                        last edited by

                        On a domain, it is kinda of hard to get the accurate logon date if you have multiple DCs and the attribute syncs randomly as users connect through Different DCs in that same manner even if you had only one DNS Server setup.

                        scottalanmillerS black3dynamiteB PhlipElderP 3 Replies Last reply Reply Quote 1
                        • scottalanmillerS
                          scottalanmiller @dbeato
                          last edited by

                          @dbeato said in Get User Last Login from Windows:

                          On a domain, it is kinda of hard to get the accurate logon date if you have multiple DCs and the attribute syncs randomly as users connect through Different DCs in that same manner even if you had only one DNS Server setup.

                          Yeah, kind of a huge weakness in AD. The kind of info you'd like to have be clear, concise, easily at hand, and very accurate is something AD actually breaks and makes extremely difficult (and/or costly) to provide.

                          1 Reply Last reply Reply Quote 1
                          • black3dynamiteB
                            black3dynamite @dbeato
                            last edited by black3dynamite

                            @dbeato said in Get User Last Login from Windows:

                            On a domain, it is kinda of hard to get the accurate logon date if you have multiple DCs and the attribute syncs randomly as users connect through Different DCs in that same manner even if you had only one DNS Server setup.

                            Any way of combining Get-ADComputer and Get-ADUser to improve the accuracy?

                            scottalanmillerS 1 Reply Last reply Reply Quote 0
                            • scottalanmillerS
                              scottalanmiller @black3dynamite
                              last edited by

                              @black3dynamite said in Get User Last Login from Windows:

                              @dbeato said in Get User Last Login from Windows:

                              On a domain, it is kinda of hard to get the accurate logon date if you have multiple DCs and the attribute syncs randomly as users connect through Different DCs in that same manner even if you had only one DNS Server setup.

                              Any way of combining Get-ADComputer and Get-ADUser to improve the accuracy?

                              Lots of scripting 🙂

                              1 Reply Last reply Reply Quote 0
                              • PhlipElderP
                                PhlipElder @dbeato
                                last edited by

                                @dbeato said in Get User Last Login from Windows:

                                On a domain, it is kinda of hard to get the accurate logon date if you have multiple DCs and the attribute syncs randomly as users connect through Different DCs in that same manner even if you had only one DNS Server setup.

                                If there are several sites then one can run the poll against the local DC by running the script there.

                                It should be able to be tweaked to poll all DCs in the forest if need be. I've not had a need to.

                                In the same domain where replication is not delimited by WAN Link timing the results should be pretty accurate no matter the DC count.

                                1 Reply Last reply Reply Quote 0
                                • PhlipElderP
                                  PhlipElder
                                  last edited by PhlipElder

                                  Via the ActiveDir list:

                                  https://github.com/CarlWebster

                                  There are some amazing scripts in there for ADDS but also for XenApp, NetScaler, Citrix, and others.

                                  Site: https://carlwebster.com/downloads/download-info/active-directory-2/

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post