Digisoul Posted February 3, 2009 Share Posted February 3, 2009 Hello guys, I want to know that how can i get the user name of currently active user from Service Account. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
furrycow Posted February 3, 2009 Share Posted February 3, 2009 Hello guys,I want to know that how can i get the user name of currently active user from Service Account.Did you even look in the help file?!I just searched "system" in the help file and found this in 5 seconds...@KBLayout Returns code denoting Keyboard Layout. See Appendix for possible values. @OSLang Returns code denoting OS Language. See Appendix for possible values. @OSType Returns "WIN32_NT" for NT/2000/XP/2003/Vista and returns "WIN32_WINDOWS" for 95/98/Me @OSVersion Returns one of the following: "WIN_2008", "WIN_VISTA", "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95" @OSBuild Returns the OS build number. For example, Windows 2003 Server returns 3790 @OSServicePack Service pack info in the form of "Service Pack 3" or, for Windows 95, it may return "B" @ProcessorArch Returns one of the following: "X86", "IA64", "X64" @ComputerName Computer's network name. @UserName ID of the currently logged on user. @IPAddress1 IP address of first network adapter. Tends to return 127.0.0.1 on some computers. @IPAddress2 IP address of second network adapter. Returns 0.0.0.0 if not applicable. @IPAddress3 IP address of third network adapter. Returns 0.0.0.0 if not applicable. @IPAddress4 IP address of fourth network adapter. Returns 0.0.0.0 if not applicable. @DesktopHeight Height of the desktop screen in pixels. (vertical resolution) @DesktopWidth Width of the desktop screen in pixels. (horizontal resolution) @DesktopDepth Depth of the desktop screen in bits per pixel. @DesktopRefresh Refresh rate of the desktop screen in hertz. Instant Lockerz Invite - www.instantlockerzinvite.co.uk Link to comment Share on other sites More sharing options...
Digisoul Posted February 3, 2009 Author Share Posted February 3, 2009 Did you even look in the help file?!I just searched "system" in the help file and found this in 5 seconds...@KBLayout Returns code denoting Keyboard Layout. See Appendix for possible values. @OSLang Returns code denoting OS Language. See Appendix for possible values. @OSType Returns "WIN32_NT" for NT/2000/XP/2003/Vista and returns "WIN32_WINDOWS" for 95/98/Me @OSVersion Returns one of the following: "WIN_2008", "WIN_VISTA", "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95" @OSBuild Returns the OS build number. For example, Windows 2003 Server returns 3790 @OSServicePack Service pack info in the form of "Service Pack 3" or, for Windows 95, it may return "B" @ProcessorArch Returns one of the following: "X86", "IA64", "X64" @ComputerName Computer's network name. @UserName ID of the currently logged on user. @IPAddress1 IP address of first network adapter. Tends to return 127.0.0.1 on some computers. @IPAddress2 IP address of second network adapter. Returns 0.0.0.0 if not applicable. @IPAddress3 IP address of third network adapter. Returns 0.0.0.0 if not applicable. @IPAddress4 IP address of fourth network adapter. Returns 0.0.0.0 if not applicable. @DesktopHeight Height of the desktop screen in pixels. (vertical resolution) @DesktopWidth Width of the desktop screen in pixels. (horizontal resolution) @DesktopDepth Depth of the desktop screen in bits per pixel. @DesktopRefresh Refresh rate of the desktop screen in hertz.Thanks for your kind reply. I know very well about @Username macro.i want to know that how can i get the ID of the currently logged on user, from System Account.I am using Service PROCESS , and when ever i user @username macro it will retun me <b>"SYSTEM"</b>hope so you will understand my problem. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Digisoul Posted February 7, 2009 Author Share Posted February 7, 2009 Hello is there any topic in this forum about my requirements. i tried to search but me faild so plz help me. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 7, 2009 Developers Share Posted February 7, 2009 It could be that your question isn't clear... Username of System account ? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Digisoul Posted February 7, 2009 Author Share Posted February 7, 2009 (edited) It could be that your question isn't clear... Username of System account ?i have a service process, now i want the username of normal loged in account name.bcoz if i use @username in service process it will give me System not the loged in User name.hope so it will clear the concept. Edited February 9, 2009 by Digisoul 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Spiff59 Posted February 7, 2009 Share Posted February 7, 2009 (edited) Maybe you need to grab the SID out of HKLM\software\Microsoft\windows NT\currentversion\winlogon, then compare it to the list of SID entries you'll find that loo like this: HK_Users\<SID>\software\microsoft\windows\currentversion\explorer\shell. Once you have a match I think it's easy to pull the username.Not sure how helpful, but this command-line utility is related:PsGetSid v1.43Edit: Well, my registry doesn't quite look like what I expected. I only have a single user account defined. Searching "SID" here might get you something... or this might be somewhat useful:Well-known security identifiers in Windows operating systems Edited February 7, 2009 by Spiff59 Link to comment Share on other sites More sharing options...
Digisoul Posted February 9, 2009 Author Share Posted February 9, 2009 Thanks for your help guys but im not understatnding anything. i have some question 1. where from i get these SID 2. how can i know that which user or Sid is currently Active ? Thanks for your kind help. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Anteaus Posted February 9, 2009 Share Posted February 9, 2009 I think if you look under HKCU\Volatile Environment the strings in there should identify the logged-on user. Link to comment Share on other sites More sharing options...
Digisoul Posted February 9, 2009 Author Share Posted February 9, 2009 I think if you look under HKCU\Volatile Environment the strings in there should identify the logged-on user.I already checked this key, its not valid when you run any process in System Account. why this thing become a challenge for me? any other possible solution ? 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
SpookMeister Posted February 9, 2009 Share Posted February 9, 2009 This is a VB script to find the username of a user logged into a remote machine... perhaps someone can help you translate it to autoit: strComputer = "atl-ws-o1" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colComputer = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colComputer Wscript.Echo "Logged-on user: " & objComputer.UserName Next [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 9, 2009 Share Posted February 9, 2009 I already checked this key, its not valid when you run any process in System Account. why this thing become a challenge for me? any other possible solution ?So you want to run a script as a service under the SYSTEM account, and have it track what user is logged in to the desktop? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Digisoul Posted February 10, 2009 Author Share Posted February 10, 2009 So you want to run a script as a service under the SYSTEM account, and have it track what user is logged in to the desktop? Ah! thanks GOD some1 understand what i want.have you any Idea ? 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Spiff59 Posted February 10, 2009 Share Posted February 10, 2009 (edited) Here's a translation, seems to work... Dim $colComputer, $TargetComputer = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & $TargetComputer & "\root\cimv2") If Not IsObj($objWMIService) Then MsgBox(1,"", "ObjGet error") $colComputer = $objWMIService.ExecQuery("SELECT * from Win32_ComputerSystem") For $objComputer in $colComputer MsgBox(1,"", $objComputer.UserName) Next Here at home I haven't any remote computer to try with, but am assuming if you have the rights, you could change the "." to a server name. edit: a bit 'o cleanup Edited February 10, 2009 by Spiff59 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