AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A_Username documentation

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
interiot



Joined: 06 Nov 2005
Posts: 64

PostPosted: Tue May 27, 2008 11:00 pm    Post subject: A_Username documentation Reply with quote

The documentation says that A_UserName is "The logon name of the current user". But when if launched by RunAs, or if running as a service, this isn't the case.

MSDN's decription is more accurate: It's the username associated with the current thread (which is the same thing as the "The logon name associated with the current process" for all AHK scripts).


Is there a good suggested alternative in these cases? I'm not sure. WTSGetActiveConsoleSessionId may be a good starting place, but I can't get it to work. Several others have suggested finding the explorer.exe process, and finding out who owns that process, though that doesn't work if the explorer.exe process has crashed. Still others suggest trolling HKEY_USERS, converting those text SIDs into binary SIDs that you can use to find the usernames. There must be some terse way to do this...


Last edited by interiot on Thu May 29, 2008 4:06 am; edited 3 times in total
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 148
Location: USA

PostPosted: Tue May 27, 2008 11:06 pm    Post subject: Reply with quote

Is this what displays in the "User Name" optional column in the Task Manager? (menu:View > Seclect Columns... > Checkbox:User Name) Just wondering.
_________________
Back to top
View user's profile Send private message
k3ph



Joined: 21 Jul 2006
Posts: 127

PostPosted: Thu May 29, 2008 2:06 am    Post subject: Reply with quote

hmm, you could check whoami (windows resource kit)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group