Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Login & Logoff Scripts (Windows XP SP2)

    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

  2. #2
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Login & Logoff Scripts (Windows XP SP2)

    Wouldn't it be simpler to use XP's Audit Policy to track this?
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  3. #3
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Login & Logoff Scripts (Windows XP SP2)

    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

  4. #4
    Silver Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    2,328
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Login & Logoff Scripts (Windows XP SP2)

    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

  5. #5
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Login & Logoff Scripts (Windows XP SP2)

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

    Jamie

  6. #6
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Login & Logoff Scripts (Windows XP SP2)

    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.
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  7. #7
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Login & Logoff Scripts (Windows XP SP2)

    Edited by HansV to insert <!t>[%]<!/t> 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
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  8. #8
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Login & Logoff Scripts (Windows XP SP2)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •