Jump to content

Need help with grabbing user name


Recommended Posts

Hi, I'm having a little trouble grabbing a user name. I have a script currently that grabs OS, RAM, Hard Drive, etc for invenotry that runs as a startup script and saves to sql. Currently I grab the user name, which all of our employee numbers are there user name. Example: 16830 is the user name I'm getting. However, I want to get there actual Employee Name. In Active Directory, for each user, there Display name is their full name. In Windows, when I click start, it says log off "John Doe" so the Display name is being passed with each user name.

So, based on that. I need assistance obtaining the Display Name from Active Directory, based on the username of the currently logged in user. Thanks ahead of time for your help!

Link to comment
Share on other sites

@UserName ?

8)

BTW.... Welcome to the Autoit Forums... 8)

I am using @username to grab the user name. Yes that is working. User name is returning as 16830, which is the employee #. But I also want to grab their FULL NAME which is the Display Name in Active Directory.

Link to comment
Share on other sites

Yes I did try that. And I used this usage of it:

dsquery user -samid %username%

and it returns what I'm looking for.

So now, I just have to have that command run within AutoIt, any help with running that dos command in autoit daram??

Link to comment
Share on other sites

Yes I did try that. And I used this usage of it:

dsquery user -samid %username%

and it returns what I'm looking for.

So now, I just have to have that command run within AutoIt, any help with running that dos command in autoit daram??

Run or ShellExecute, mayhap? I dont quite know much more to suggest myself.

Luckily there are much smarter people than me hanging around here. :D

Link to comment
Share on other sites

Run or ShellExecute, mayhap? I dont quite know much more to suggest myself.

Luckily there are much smarter people than me hanging around here. :D

Tried that. And I keep getting an error saying error in dsquery. Missing entry:user.

The same command runs fine from command line, but when using shellexecute i get this error. HELP! Need o get this done today. Thanks guys!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...