UPN vs. SAM account names

hello, i'm wondering if there is a downside to using the UPN vs. the SAM account names in AD.  SAM (or pre-2000) login has a 20 character limit, which becomes problematic in my environment.  is the SAM account name ever going to go away, as the name suggests, pre-2000 rarely exists these days.

also, i was wondering if there was a %_% shortcut for the UPN - when you use %username% it pulls the SAM, i'd like to use that notation to pull in the UPN.  

thanks!
jhaffAsked:
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.

Mike KlineCommented:
No downside if you need to exceed the limit.  I doubt samaccountname will every go away.  I think when Windows 2000 initially came out there was a hope that the UPN would take off as the default login name but really it hasn't.  Not sure why that never happened.

I haven't tested %userprinciapalname%...not sure on that one.

Thanks

Mike
0
-tjsCommented:
The %_% shortcuts are really pulling from environment variables.  Unfortunately there is no built-in evnironment variable for UPN, but you could have a login script populate one for you when the user logs in:
Command Line Example:
for /f "delims=" %x in ('dsquery * -filter "(samaccountname=%username%)" -attr userprincipalname -l') do set UPN=%x
Batch File Example:
for /f "delims=" %%x in ('dsquery * -filter "(samaccountname=%%username%%)" -attr userprincipalname -l') do @set UPN=%%x

There are no published plans for samaccountname to be changed or go away, and userprinciplename does not have to resemble samaccountname.  Many apps though still require a user to specify login as DOMAIN\username, which is their samaccountname, so keep that in mind.
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
jhaffAuthor Commented:
no go on the %userprincipalname%... anyone know where i can find a list of the %_% variables?
0
-tjsCommented:
Type "set" at the command prompt. There are a few hidden ones that can be seen with "set /?".
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
Active Directory

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.