Stuart_C Posted May 13, 2010 Posted May 13, 2010 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\UserName with %USERNAME% This works and is OK, but would be much better if I could pick a users "Name" (e.g John S. Smith)
Richie1972 Posted May 13, 2010 Posted May 13, 2010 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
Stuart_C Posted May 14, 2010 Author Posted May 14, 2010 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"
ajbritton Posted May 16, 2010 Posted May 16, 2010 It is possible to get this info from CMD using the following; @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. Set objSysInfo = CreateObject("ADSystemInfo") strUser = objSysInfo.UserName Set objUser = GetObject("LDAP://" & strUser) strFullName = objUser.Get("displayName") MsgBox strFullName
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now