Capturing lonon name while someone is being logged on

Discussion in 'Scripting' started by Rishi Kandel, Feb 26, 2004.

  1. Rishi Kandel

    Rishi Kandel Guest

    Could you please let me know if we can capture the logon
    name using windows scripting technologies while someone is
    being logged on to the network (Active Directory).

    I am trying to write the generic script that runs in the
    Active Directory in Win 2000 Server. The purpose of this
    script would be identifying the user while they try to
    logon to the system and it would set the user profile,
    network resources like printers and drives and so on. I am
    having trouble capturing the user name while they trying
    to logon.

    Any idea to work around this issue.

    Thanks
    Rishi
     
    Rishi Kandel, Feb 26, 2004
    #1
    1. Advertisements

  2. I am curious as to why you don't let Windows do this for you. You place the
    logon script and the profile path in the user account. Why reinvent the wheel?

    --
    Regards,

    Michael Holzemer
    No email replies please - reply in newsgroup

    Learn script faster by searching here
    http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
     
    Michael Holzemer, Feb 26, 2004
    #2
    1. Advertisements

  3. I assume you mean that you want this to be done in the logon script, as
    opposed to your sitting at an administrative console running a script
    waiting to see who logs on next somewhere on the network.
    What operating system runs on the user workstations? If it is NT4 or up,
    this will work:

    set WSHNetwork = createobject("wscript.network")
    username = WSHNetwork.username

    If 98 or less, this will not work if your scripts are being run
    synchronously. If asynchronously, then you need to use a loop to test the
    value of the username attribute until it becomes non-blank.


    /Al
     
    Al Dunbar [MS-MVP], Feb 26, 2004
    #3
  4. Rishi Kandel

    Guest Guest

    Hi Michael;
    Thanks for your reply. The concept is having one universal
    script for everyone instead of creating multiple .bat file
    as logon script.

    once we capture the logon name while they are being logged
    on, we can map the drives and give access to other
    resources.

    Regards
    Rishi
     
    Guest, Feb 26, 2004
    #4
  5. You can have the global Login script be placed on everyone's login so that
    it runs whenever someone logs in, and the script can certainly capture the
    username of the person that just logged in (since this runs right AFTER the
    person logs in) and do whatever it wants.

    It is EXACTLY what you are trying to do, so just try out the feature and do
    not re-invent the wheel.

    --
    //David
    IIS
    This posting is provided "AS IS" with no warranties, and confers no rights.
    //
    Hi Michael;
    Thanks for your reply. The concept is having one universal
    script for everyone instead of creating multiple .bat file
    as logon script.

    once we capture the logon name while they are being logged
    on, we can map the drives and give access to other
    resources.

    Regards
    Rishi
     
    David Wang [Msft], Feb 26, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.