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\S hell\Assoc iations\Ur lAssociati ons\http\U serChoice C:\default_browser.txt\
How can i gather this information for the logged user or last loggedon user?
Thank you so much.
JC
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
How can i gather this information for the logged user or last loggedon user?
Thank you so much.
JC
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.Shel l")
RegKey = "HKLM\SOFTWARE\Microsoft\W indows\Cur rentVersio n\Authenti cation\Log onUI\"
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\Softwar e\Microsof t\Windows\ Shell\Asso ciations\U rlAssociat ions\http\ UserChoice " to know which default browser they have.
There is a way to know the last logged on userby using this vbscript:
Option Explicit
Dim WSHShell, RegKey, Username
Set WSHShell = CreateObject("WScript.Shel
RegKey = "HKLM\SOFTWARE\Microsoft\W
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\Softwar
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
- 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!