I have a requirement to display last successful logon for an account and
the location from which that logon occurred. When a user logs on to a
workstation the location would of course be the hostname of that
workstation. I'm using Visual Basic Scripting to do this. It was working
fine until today while I was of course showing it to our security person.

Even though I took into account when the user logs on to a workstation
and the %CLIENTNAME% environment variable is not set, it seems that for
some reason when logging onto a server %CLIENTNAME% can be set to
"console" sometimes. This is strange considering I'm not asking for the
Session Name which can be "console". I'm asking for the Client Name.
When %CLIENTNAME% equals "console" when running my script or when
running the 'set' command, if I look at the Users tab in Task Manager
the Client Name is still the hostname of the maching I'm using to remote
into the server.

Strangely, I thought that on the Users tab the Session Name would be
listed as "console" when I use Remote Desktop to logon to the console of
the server. I'm using Win2k3 R2. The Session name is always a RDP
session # whether I connect to the console or not. But that's not
something I'm worrying about at the moment.

Can anyone explain to me the circumstances that cause %CLIENTNAME% to be
set to "console" as opposed to the user's workstation? I could test for
it in my script if I knew the conditions under which it occurs. I'm
currently using the following to grab the variable:
strFromHost = objShell.ExpandEnvironmentStrings("%CLIENTNAME%")

Thanks
Brandon

Re: finding out client name for a user logging in to a remote server by Richard

Richard
Wed Jul 09 19:54:20 PDT 2008


"Brandon McCombs" <none@none.com> wrote in message
news:487561dc$0$20117$9a6e19ea@unlimited.newshosting.com...
>I have a requirement to display last successful logon for an account and
>the location from which that logon occurred. When a user logs on to a
>workstation the location would of course be the hostname of that
>workstation. I'm using Visual Basic Scripting to do this. It was working
>fine until today while I was of course showing it to our security person.
>
> Even though I took into account when the user logs on to a workstation and
> the %CLIENTNAME% environment variable is not set, it seems that for some
> reason when logging onto a server %CLIENTNAME% can be set to "console"
> sometimes. This is strange considering I'm not asking for the Session Name
> which can be "console". I'm asking for the Client Name. When %CLIENTNAME%
> equals "console" when running my script or when running the 'set' command,
> if I look at the Users tab in Task Manager the Client Name is still the
> hostname of the maching I'm using to remote into the server.
>
> Strangely, I thought that on the Users tab the Session Name would be
> listed as "console" when I use Remote Desktop to logon to the console of
> the server. I'm using Win2k3 R2. The Session name is always a RDP session
> # whether I connect to the console or not. But that's not something I'm
> worrying about at the moment.
>
> Can anyone explain to me the circumstances that cause %CLIENTNAME% to be
> set to "console" as opposed to the user's workstation? I could test for it
> in my script if I knew the conditions under which it occurs. I'm currently
> using the following to grab the variable:
> strFromHost = objShell.ExpandEnvironmentStrings("%CLIENTNAME%")
>
> Thanks
> Brandon

The clientname environment variable is new to me, I've never seen it used.
In my network when logged into most computers (including servers) there is
no value. On an XP client the value is "console".

The computername environment variable should always be the NetBIOS name of
the local computer. In VBScript you can also retrieve the ComputerName
property of the wshNetwork object. For example:

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--



Re: finding out client name for a user logging in to a remote server by Richard

Richard
Wed Jul 09 20:08:54 PDT 2008


"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:OrzeUhj4IHA.1204@TK2MSFTNGP04.phx.gbl...
>
> "Brandon McCombs" <none@none.com> wrote in message
> news:487561dc$0$20117$9a6e19ea@unlimited.newshosting.com...
>>I have a requirement to display last successful logon for an account and
>>the location from which that logon occurred. When a user logs on to a
>>workstation the location would of course be the hostname of that
>>workstation. I'm using Visual Basic Scripting to do this. It was working
>>fine until today while I was of course showing it to our securit