+ Post New Thread
Results 1 to 4 of 4
Windows Thread, Environment Variable for a users full name. in Technical; I was wondering if there was a variable for a users full name? I want to add a users full ...
  1. #1

    Join Date
    Nov 2007
    Location
    Rotherham
    Posts
    1,675
    Thank Post
    122
    Thanked 126 Times in 102 Posts
    Rep Power
    45

    Environment Variable for a users full name.

    I was wondering if there was a variable for a users full name?
    I want to add a users full name into the reg key for the office user at login. I've been playing and I've used GP Preferences to replace the current value of
    CU\Software\Microsoft\Office\Common\UserInfo\UserN ame with %USERNAME%

    This works and is OK, but would be much better if I could pick a users "Name" (e.g John S. Smith)

  2. #2
    Richie1972's Avatar
    Join Date
    Apr 2006
    Location
    Blackburn
    Posts
    239
    Thank Post
    2
    Thanked 6 Times in 6 Posts
    Rep Power
    18
    No, there isn't.
    Type set from a cmd prompt and it'll show you all the current environment variables.
    Your only option, really, is going to be to use a vbscript that queries active directory for the value

  3. #3

    Join Date
    Nov 2007
    Location
    Rotherham
    Posts
    1,675
    Thank Post
    122
    Thanked 126 Times in 102 Posts
    Rep Power
    45
    Rubbish... better head over to the scripting forum and see if someone can tell me how to do that then.
    My VBS skills are best described as "poor"

  4. #4
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    34
    It is possible to get this info from CMD using the following;

    Code:
    @echo off
    for /f "tokens=2*" %%a in ('net user "%Username%" /domain ^| find /i "Full Name"') do set DisplayName=%%b
    echo Your display name is "%DisplayName%"
    above code from this Experts Exchange post

    Alternatively, using VB, the following code (although not tested as I wrote at home), should get the full name (aka DisplayName) into the strFullName variable for you. You then have the fun job of writing it to the registry using WMI if you insist on using VB.

    Code:
    Set objSysInfo = CreateObject("ADSystemInfo")
    strUser = objSysInfo.UserName
    Set objUser = GetObject("LDAP://" & strUser)
    strFullName = objUser.Get("displayName")
    MsgBox strFullName

SHARE:
+ Post New Thread

Similar Threads

  1. Pass a program variable in VB Script?
    By cookie_monster in forum Coding
    Replies: 21
    Last Post: 22nd April 2013, 08:04 AM
  2. Copy file across variable folder name
    By SimpleSi in forum *nix
    Replies: 11
    Last Post: 10th March 2009, 06:15 PM
  3. Moodle - undefined variable error
    By damienharrison in forum Virtual Learning Platforms
    Replies: 5
    Last Post: 26th September 2007, 10:15 AM
  4. Batch: Text file -> Environment variable?
    By PiqueABoo in forum Scripts
    Replies: 5
    Last Post: 13th December 2006, 11:09 PM
  5. %Userprofile% Variable not being set.
    By drjturner in forum Windows
    Replies: 16
    Last Post: 23rd November 2006, 09:07 PM

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
  •