Announcement

Collapse
No announcement yet.

how to determine login time

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to determine login time

    i have 2 user log on to windows XP workgroup (not domain)
    user have full day access and the 2nd one have 4 hours only how can determine it.

    glad

  • #2
    Re: how to determine login time

    Are you trying to restrict the users to that time or find out how long they were on for or when they last logged on and off?

    Comment


    • #3
      Re: how to determine login time

      Originally posted by Virtual View Post
      Are you trying to restrict the users to that time or find out how long they were on for or when they last logged on and off?
      assume the login time between 10:00 am - 2:00 pm

      Comment


      • #4
        Re: how to determine login time

        The only way I cna think of is lookng at the 'security' logs fo Event Viewer.

        Comment


        • #5
          Re: how to determine login time

          Is it XP Pro? If so you could use a logon and logoff script.

          Logon:
          Code:
          Echo %username% has logged on at %time% %date% >> c:\logontimes.log
          Logoff:
          Code:
          Echo %username% has logged off at %time% %date% >> c:\logontimes.log
          To apply the script:
          - Start -> Run -> type in gpedit.msc and click OK
          - Expand User Configuration\Windows Settings\Scripts

          Let me know if yo have any questions.
          Regards,
          Jeremy

          Network Consultant/Engineer
          Baltimore - Washington area and beyond
          www.gma-cpa.com

          Comment


          • #6
            Re: how to determine login time

            thx alot but i wanna to prevent access before and after the period time

            Comment


            • #7
              Re: how to determine login time

              Can we modify script to use if close or something like this

              if close for user and one for time

              --------------
              if user=user1 and time>10:00am and time<2:00pm
              then logon
              else logout
              ----------------------------

              Comment


              • #8
                Re: how to determine login time

                Ah, you're not trying to just get a log of information but to actually control the logon times.

                You could setup a scheduled task to run the following VBS script to log the user off if he's logged on. So if you want the user off at 2 then schedule the task to run at 2.

                Code:
                '* change the green highlighted username to your specific user
                '* if the user is not part of a domain then use computer\user
                strUsername = "domain\user"
                strComputer = "."
                
                Set objWMIService = GetObject("winmgmts:" _
                    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                set colCompSys = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
                
                
                For Each objCompSys in colCompSys
                  strLoggon = objCompSys.UserName
                Next
                
                If StrComp(strUserName, strLoggon, vbTextCompare) = 0 Then
                  Set colOS = objWMIService.ExecQuery("SELECT * FROM win32_OperatingSystem")
                  For Each objOS in colOS
                    objOS.Win32Shutdown(4)
                  Next
                End If
                You will then also need to set the logon hours for the user.
                If it an Active Directory environment then you can set the logon hours in the user's properties account tab. If it's a local user you can use the net user command to set the logon hours:
                Code:
                net user username /time:M-F,10am-2pm
                Note that setting the logon hours is a one time configuration.

                The script will log the user off, it won't prevent him from logging on outside the specified hours.
                The net user command will prevent the user from logging on outside the specified hours, it won't log them off when it becomes outside the specified time while they're logged in.
                So with both together it should prevent the user from being on the computer outside the specified times.
                Last edited by JeremyW; 25th February 2009, 23:31. Reason: words missing...... hard to understand if words are missing.... ;)
                Regards,
                Jeremy

                Network Consultant/Engineer
                Baltimore - Washington area and beyond
                www.gma-cpa.com

                Comment


                • #9
                  Re: how to determine login time

                  If you are not in a AD environment you could also add the script to run from the logon script..

                  IE: logon.bat
                  Echo %username% has logged on at %time% %date% >> c:\logontimes.log
                  cscript c:\scripts\checkuser.vbs //B //Nologo
                  rem Change the paths to wherever you put / want the files
                  --------------------

                  IE: checkuser.vbs
                  '* change the green highlighted username to your specific user
                  '* if the user is not part of a domain then use computer\user
                  strUsername = "domain\user"
                  strComputer = "."

                  Set objWMIService = GetObject("winmgmts:" _
                  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                  set colCompSys = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,4


                  For Each objCompSys in colCompSys
                  strLoggon = objCompSys.UserName
                  Next

                  If StrComp(strUserName, strLoggon, vbTextCompare) = 0 Then
                  Set colOS = objWMIService.ExecQuery("SELECT * FROM win32_OperatingSystem")
                  For Each objOS in colOS
                  objOS.Win32Shutdown(4)
                  Next
                  End IF

                  ---------------

                  This would create a log for you and each time someone logs on it would run the check to and log them out automatically..

                  Later,
                  Hobie

                  Comment


                  • #10
                    Re: how to determine login time

                    Sounds like a kiosk situation. If you have the $$, you can purchase software which controls who logs onto what machine, at what times and for how long- this is how the internet cafes work.

                    As already stated, an alternative would be to setup a domain and use AD Group Policy to control anything and everything with your workstations.
                    |
                    +-- JDMils
                    |
                    +-- Regional Systems Engineer, DotNet programmer & Jack of all trades
                    |

                    Comment


                    • #11
                      Re: how to determine login time

                      Where must i run these command and how can i remove it in future

                      net user username /time:M-F,10am-2pm

                      Comment


                      • #12
                        Re: how to determine login time

                        You need to run it from the command line on each computer that has the user since this is a workgroup.

                        To "remove" the setting you can run the following:

                        Code:
                        net user username /time:all
                        Regards,
                        Jeremy

                        Network Consultant/Engineer
                        Baltimore - Washington area and beyond
                        www.gma-cpa.com

                        Comment

                        Working...
                        X