natetron66 Posted April 6, 2009 Share Posted April 6, 2009 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 More sharing options...
Valuater Posted April 6, 2009 Share Posted April 6, 2009 (edited) @UserName ? 8) BTW.... Welcome to the Autoit Forums... 8) Edited April 6, 2009 by Valuater Link to comment Share on other sites More sharing options...
natetron66 Posted April 6, 2009 Author Share Posted April 6, 2009 @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 More sharing options...
DaRam Posted April 6, 2009 Share Posted April 6, 2009 Check out %windir%\System32\rundll32.exe dsquery,OpenQueryWindow Link to comment Share on other sites More sharing options...
natetron66 Posted April 6, 2009 Author Share Posted April 6, 2009 Check out %windir%\System32\rundll32.exe dsquery,OpenQueryWindow How's that help? Link to comment Share on other sites More sharing options...
DaRam Posted April 6, 2009 Share Posted April 6, 2009 Did you try it? It can be used to query AD. Once you have it working for a single user, then you can possibly script it for other users.Aaah, Forget it! Just look here http://www.autoitscript.com/forum/index.ph...45&p=386373How's that help? Link to comment Share on other sites More sharing options...
natetron66 Posted April 6, 2009 Author Share Posted April 6, 2009 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 More sharing options...
Zombie1982 Posted April 6, 2009 Share Posted April 6, 2009 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. Link to comment Share on other sites More sharing options...
natetron66 Posted April 6, 2009 Author Share Posted April 6, 2009 Run or ShellExecute, mayhap? I dont quite know much more to suggest myself.Luckily there are much smarter people than me hanging around here. 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 More sharing options...
weaponx Posted April 6, 2009 Share Posted April 6, 2009 Here you go:#570726 Link to comment Share on other sites More sharing options...
natetron66 Posted April 6, 2009 Author Share Posted April 6, 2009 Here you go:#570726Dude thanks so much!!! Exactly what I was looking for!!! Link to comment Share on other sites More sharing options...
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