Environment Variable

Hi,
I was just wondering if it was possible to set an environment variable for the user's first name in windows server 2008?
If first name isn't possible, how about Full Name? because at the moment all i can do is %username% which is not always the users name.

If you need more details, please ask...
scott321Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

B HCommented:
check out the bottom post here:
http://discussions.virtualdr.com/showthread.php?t=61215

something like that?
0
Chris DentPowerShell DeveloperCommented:

You can, but what do you need it for? There are quite a few ways to get the first name from a domain.

Chris
0
scott321Author Commented:
@byron, could you explain how i would use this, i'm feeling stupid for not undertanding but hey ho.
@chris, please see screenshot...
Untitled.png
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

B HCommented:
so if you add a startup script with this code, or add this code to your startup script...


set FirstName=Blank
for /f "tokens=2-3" %%v in ('Net User /DO %username%^|Find /i "Full Name "') do set FirstName=%%w


after that, you can address %firstname%  and it will resolve to the users active directory first name
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
B HCommented:
example:

C:\DOCUME~1\bryon>type fullname.bat
set FirstName=Blank
for /f "tokens=2-3" %%v in ('net user /DO %username%^|find /i "Full Name "') do set firstname=%%w


C:\DOCUME~1\bryon>fullname

C:\DOCUME~1\bryon>set FirstName=Blank

C:\DOCUME~1\bryon>for /F "tokens=2-3" %v in ('net user /DO bryon2|find /i "Full Name "') do set firstname=%w

C:\DOCUME~1\bryon>set firstname=Bryon
C:\DOCUME~1\bryon>echo %firstname%
Bryon

C:\DOCUME~1\bryon>

0
scott321Author Commented:
THANKS!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.