/build/static/layout/Breadcrumb_cap_w.png

Windows logon user / interactive user

Hi

Is there a way to find out the windows logon username from a dos-promt (ex with a tool) when the promt is started as LocalSystem?
This is on a Windows XP system.

I'm going to us the username to get the SID of the user so I can change the login user / current_users registry-settings.
The tool I will use i PSGetSID from Sysinternals to find the SID.

0 Comments   [ + ] Show comments

Answers (4)

Posted by: revizor 17 years ago
Third Degree Blue Belt
0
I'm going to us the username to get the SID of the user so I can change the login user / current_users registry-settings.

I'm a bit puzzled why you pursue this route, don't your users ever log on (so you can hit them with the logon script)?

You can use psloggedon utility to see who's currently logged on to the system...

Or, see if this piece of code can help you:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web%20WinBatch/UDF~-~UDS~Library%20Get~Current~User~List.txt
Posted by: espen 17 years ago
Senior Yellow Belt
0
Thanks revizor,

but our users dont have local administrator rights. So when we push software to our users it running in the context of the localsytsem.
Since it's localsystem, the hkey_current user will not be the logged in users.

Espen
Posted by: revizor 17 years ago
Third Degree Blue Belt
0
Do you care if the HKCU settings go to all users or only to specific ones on a given PC?
I could suggest:
a) creating self-healing msi
b) pushing "RunOnce" script to change HKCU
c) using custom group policy templates

Out of curiosity, what is supposed to trigger software install in your case? Are you engaging SMS, or anything alone those lines?
Posted by: AngelD 17 years ago
Red Belt
0
By using WMI script this could be achieved.
The owner of the explorer.exe process would be the user currently logged in.
If the explorer.exe process could not be found then this would state that now user is currently logged in.

strComputer = "."
strUser = ""
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process")

For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If objProcess.Name = "explorer.exe" Then
strUser = strNameOfUser
Exit For
End If
Next
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ