Link to home
Start Free TrialLog in
Avatar of Joel Caldas
Joel Caldas

asked on

How to use the LastLoggedOn username registry information and retrieve the default browser of that username

Hello,

My intention is to retrieve information of all active users in a domain. For that i use a command line running by the software BMC Client Management. This command runs well but the problem is that the information gathered is from the admin user.

REG EXPORT HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice C:\default_browser.txt\

How can i gather this information for the logged user or last loggedon user?

Thank you so much.
JC
Avatar of Ajit Singh
Ajit Singh
Flag of India image

If I am getting you correctly, then you can use one of these attributes:

- lastlogontimestamp: It may be delayed with 0-14 days
- lastlogon: It is not replicated between DCs so you have to query all DCs and keep only the highest value

For "lastlogontimestamp", run: dsquery * DN_User -attr lastlogontimestamp

For "lastlogon", run: dsquery * DN_User -attr lastlogon -s DC_name. You should run it against all DCs and get the highest value.

Follow this to get in detail: http://www.rlmueller.net/Last%20Logon.htm

Did you configure auditing in your AD Environment? If yes then you can go to security event logs and check who was last logged in (with time and date). This article help you to audit the successful or failed logon and logoff attempts in the network using the audit policies.

Hope this helps!
Avatar of Joel Caldas
Joel Caldas

ASKER

Thank you but i guess i have to be more specific.
There is a way to know the last logged on userby using this vbscript:

Option Explicit
Dim WSHShell, RegKey, Username
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\"
Username = WSHShell.RegRead(RegKey & "LastLoggedOnSAMUser")

WScript.echo Username

however i must join this information (the lastloggeduser) and fetch for this specific user the key "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice " to know which default browser they have.
HKCU will return the current user which you running as administrator will return YOUR information.  You have to use the SID of the user and then LOAD that registry to get the users settings in their hkcu
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial