User Display Name variable?
Results 1 to 6 of 6

Thread: User Display Name variable?

  1. #1
    Join Date
    Mar 2000
    Location
    Uk
    Posts
    62

    User Display Name variable?

    Hi,
    Is there a way of finding out the users 'Display Name' at a workstation the user is logged in to? I know there is a user name variable, but this just holds the logon name. I want to be able to get hold of other attributes of the user, mainly the display name (or first and last name).
    The workstation must know the logged on users display name, as it dislays it at the top of the Start Menu (possibly only in XP, but still gets it from an Active Directory user)
    Many thanks,
    P

  2. #2
    Join Date
    May 2000
    Posts
    583
    You can use "net user [username]" or VBScript...
    http://www.swynk.com/winscript/

  3. #3
    Join Date
    Aug 2000
    Location
    UK
    Posts
    429
    alternatively just press ctrl+alt+del. this usually gives you the username, the username description and the domain the user is a member of, as well as the machine name.

  4. #4
    Join Date
    Jul 2001
    Posts
    880
    "Is there a way of finding out the users 'Display Name'"

    I have a question about this. First, if you're an admin and you're in a domain, then why don't you just use the Active Directory Users and computers to pull up the account info. You can install this on any 2K workstation by running the ADMINPAK.MSI off of the 2K Server CD. If, you're in a workgroup, then obviously you'd be looking for the local account information. Press CTRL+ALT+DEL to see who's logged in, and then open Lusrmgr.msc from the run command and look at the users properties. The user variable your speak of is only for the username and this is it: %user%. Also, Net User will only show local accounts on the machine. It will not show the account that is logged in if the logged in user is a domain account. You could type SET while at a command prompt to pull up the logged in user as well. It seems to me here, that if you're looking for info on a user logged in, and you're in a workgroup, there's plenty of tools available on the local machine. If you're in a domain, and it's an Active Directory domain, you can alwasy just browse the directory for the 'Users' to see the info you're looking for. Perhaps if you explain your situation a little more, we can help you more.

    ------------------
    Systems Administrator
    A+, Net+, i-Net+, CIW-A
    MCP/2K, MCP+I, MCSE/NT4

    [This message has been edited by Silicon Scream (edited 04-18-2002).]

  5. #5
    Join Date
    Mar 2000
    Location
    Uk
    Posts
    62
    Mulder, many thanks for the info...
    To clarify, for scripting purposes, I need a program to get hold of the information from the 'Display Name' field while someone is logged on. i.e. it is not me sitting at a machine that needs the info, but a program that needs to know the information. As a very basic example, say I had a script that wanted to display the username, I might write:
    echo %username%

    I effectively want to have something like:
    echo %userdisplayname%

    but that variable does not exist.
    The net user command does show information on domain users logged in - I just tried it, you have to use the /domain switch, i.e:
    net user %username% /domain
    will display information on the logged on user, including their display name.
    If I find no other way, I could use this command, output the data to a text file, scan the text file and extract the display name into a variable.
    Apologies for the poor explanation, all help appreciated.
    P

  6. #6
    Join Date
    May 2000
    Posts
    583
    OK, I forgot the /domain switch. To use net user, though...

    REM Fullname.cmd
    @echo off
    set FullName=Blank
    for /f "tokens=2,*" %%v in ('Net User /DO %1^|Find /i "Full Name "') do set FullName= %%w

    Call using:
    Fullname %username%

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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