bkiahg has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I am on a win 2000 network, with 2000 server running IIS. I have disabled anonymous logins and checked Integrated Windows authentication. Is there a perl module out there that will allow me to pull the username. Trying to run a log.

Thanks in advance!!

Replies are listed 'Best First'.
Re: Windows Username
by EdwardG (Vicar) on Apr 26, 2004 at 15:17 UTC

    You want LOGON_USER.

    This is the Windows account that the user is impersonating while connected to your Web server.

    There is extensive information on this here.

Re: Windows Username
by pelagic (Priest) on Apr 26, 2004 at 13:03 UTC
    With the following you get a list of all environment variables and their current values:
    foreach my $env_var (keys %ENV){ print "$env_var: $ENV{$env_var}\n"; }
    USERNAME should be among them ...

    pelagic
      REMOTE_USER, LOGON_USER and AUTH_USER all do the trick. Which would be the best to use? Or are they all the same?
        I'm afraid I can't answer that. That's dependant of you setup, which I don't know. What software/component/action creates what variable a.s.o. ... Some test's might show you the way to go.
        BTW be aware that all this assumes that the perl script is run by the USER or on his Workstation.

        pelagic
Re: Windows Username
by borisz (Canon) on Apr 26, 2004 at 12:57 UTC
    Untested, I have no windows.
    my $username = $ENV{USERNAME};
    Boris