• Login & Logoff Scripts (Windows XP SP2)

    Home » Forums » AskWoody support » Windows » Windows Vista, XP and earlier » Questions: Vista, XP back to 3.1 » Login & Logoff Scripts (Windows XP SP2)

    Author
    Topic
    #428948

    Hello All,

    Ain’t been around here for a while but nothing much seems to have changed, still LOADS of useful info. Now down to bussiness. Need to keep a record of whos accessing a pc in our office. Wanted to use login & logoff scripts to do this but thats where i fell short. Can anyone give me some tips on this. The script needs to:

    Login:
    Ask user for Name
    Write the date, time and name to a file

    Logoff:
    Write the date & time of logoff to the same file

    Please please help.

    P.s. Am starting my MCSE soon so maybe i’l be able to help for a change.

    Thanks in advance
    Jamie

    Viewing 1 reply thread
    Author
    Replies
    • #997823

      Wouldn’t it be simpler to use XP’s Audit Policy to track this?

      • #997825

        Never heard of it i’m afraid so i’m not sure. Will it allow me to ask for the user on login? this came about because there are multiple users (50 +) using the same machine and i want to keep an eye on it’s usage. Not perfect but don’t know any other way of doing it!

        Jamie

        • #997827

          To set auditing on your computer:

          Start | Run, type GPEDIT.MSC and hit Enter. On Group Policy console navigate to Computer configuration > Windows Settings > Security Settings > Local Policies > Audit Policy. Set events you want to monitor.

          To see auditing results:

          Start | Run, type EVENTVWR and hit Enter. On Event Viewer window, navigate to Security on the left pane and double-click each event on the right pane you want to see.

          More information:

          Chapter 3: Audit Policy

          • #997829

            But that won’t allow me to track 50 users using the same account would it?

            Jamie

            • #997831

              No, it won’t. If you have 50 users all using the same account, then your “security” is pretty well non-existant. If you want to track users via logon or logoff scripts, what’s to prevent any user from simply using a bogus name? The only way to track this reliably is to have separate accounts for each user.

            • #997904

              This website is a handy reference for scripting basics. On asking the user for a name, click VBScript Reference Guide, and then choose User Interface. On working with text files, click WSH Reference Guide, then choose File System Object.

              And this Microsoft page is a more complete reference for working with text files using the File System Object.

    • #997848

      Edited by HansV to insert [%] tags in order to avoid problems with % followed by a hex number Thanks, Hans!!

      Assuming you can find out how to set up logon and logoff scripts…

      A BATch file can be used to write the username, computername, date and time to a file (or files) ‘somewhere’ on a server, probably. You can use a single target file, or one for each PC, perhaps. You don’t have to ask the user anything!

      For the Logon script, to a single file…
      echo %date% %time% %username% logged on at %computername% >> servernamedirectorynamelogonoff.txt

      For the Logon script, to a PC-name-based file…
      echo %date% %time% %username% logged on at %computername% >> servernamedirectoryname%computername%.txt

      I think you can work out the equivalent for a logoff script!

      John

    Viewing 1 reply thread
    Reply To: Login & Logoff Scripts (Windows XP SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: