?
Solved

Get NT account forename/surname via xp_cmdshell or similar

Posted on 2009-07-10
2
Medium Priority
?
454 Views
Last Modified: 2012-05-07
I currently have a list of users in a windows group in a table - gained by using

      create table tempdb.dbo.GroupMembers(ACCOUNT_NAME nVARCHAR(128),account_type varchar(10),account_priv varchar(10),account_mapped_login_name varchar(50),account_permission_path varchar(50))

      INSERT INTO tempdb.dbo.GroupMembers
      exec XP_LOGININFO groupname,'Members'

I need to send out an email to each user - email uses a stanrd format forename.surname@company.com - but have noticed there are no standard naming conventions to the NT accounts - so I can derive the email address from the account name.

Does anyone know how I can get the surname/forenames from the NT account? I will be able to use XP_CMDSHELL or anything else. Security will be opened up to allow any type of functionality that will work - so this will not be an issue. I guess I am asking if there is an API I can call.

Many thanks.
0
Comment
Question by:PUMASOFT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
kevin_u earned 1500 total points
ID: 24825042
The link below is the source for userinfo.vbs which can get almost any user information you'd like.  Read it over, and modify it to get the informtion you need.   Then call it with xp_cmdshell as indicated in the comments (cscript).

http://www.ss64.com/wsh/userinfo.txt

0
 
LVL 2

Author Comment

by:PUMASOFT
ID: 24825129
Mmmm - might have a look at that. I will be on holiday next week. So will update week after.

Many thanks.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I read that Microsoft has analysed statistics for their security intelligence report. It revealed: still, the clear majority of windows users do their daily work as administrator. An administrative account is a burden, security-wise. My ar…
OfficeMate Freezes on login or does not load after login credentials are input.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question