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