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

  • Question

  • 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 like SCCM. 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.
    • Moved by Bill_Stewart Monday, October 2, 2017 7:06 PM Unaswerable drive-by question
    Friday, August 18, 2017 9:38 AM

All replies

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice\Progid

    Is the key for the current user in Windows 7

     is a REG_SZ value and will be one of these for the major three browsers currently available:

    • FirefoxURL
    • ChromeHTML
    • IE.HTTP

    Friday, August 18, 2017 10:10 AM
  • For windows 7 or/and windows 10.

    I use this script to know the last logged user:


    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.

    Friday, August 18, 2017 10:22 AM
  • Why not just set the default browser via group policy ?
    Friday, August 18, 2017 11:04 AM
  • I don´t want to change the default browser, i just want to query which default browser users have.
    Friday, August 18, 2017 1:08 PM
  • if you got a list of computer names you could pass those names into the powershell function below and it will tell you the default browser

    function Get-DefaultBrowser
    $Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
    $RegistryKey = $Registry.OpenSubKey("SOFTWARE\\Classes\\http\\shell\\open\\command")
    #Get (Default) Value
    $Value = $RegistryKey.GetValue("")
    return $Value
     Get-DefaultBrowser $computer

    Friday, August 18, 2017 1:21 PM
  • There is no way to get a user that is not logged on.  There is no easy way to find the current users hive.  HKEY_CURRENT_USER is  pseudo key that is only visible to the logged in users session.  You would have to get the users SID and use that as the hive name.

    HKEY_USERS\<users SID>

    Use Group Policy to control this. It is much easier.


    Friday, August 18, 2017 2:44 PM