Announcement

Collapse
No announcement yet.

Grabbing user type

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Grabbing user type

    This is a stab in the dark here, but does anyone know how to check if a user is local or Microsoft account? I need to check if the user that is active at that moment is a local user, as my tool does not condone Microsoft keylogging, but logins a user as a key rather then a full named account is a little safer and I need to be able to reflect this to the end user to help them become a little more safer on windows 8/10.

    Thanks in advance
    Plugins or Sources MokoX
    BunnyHop 2021 Here

  • #2
    Okay, here is something that might work. It would be nice if other could confirm, or report that this does not work on all computers/accounts:

    I found a registry key under HKEY_CURRENT_USER\SOFTWARE\Microsoft\IdentityCRL\U serExtendedProperties which corresponds to my email address, when using a Microsoft account to log in. This key has a value named webcredtype with the content "1".

    When using a local account, I see no key (with the email) under UserExtendedProperties.

    This works on my computers, where I saw that the key was created only when I switched from a local account to a Microsoft account (and did not even need to sign out or reboot), but it is best to hear from others that this method appears to work.

    Code:
    function bIsOnlineAccount()
        if Registry.DoesKeyExist(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\IdentityCRL\\UserExtendedProperties") then
            local tKeys = Registry.GetKeyNames(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\IdentityCRL\\UserExtendedProperties");
            
            for i = 1, #tKeys do
                if (String.Find(tKeys[i], "@") ~= -1) then
                    if (Registry.GetValue(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\IdentityCRL\\UserExtendedProperties\\" .. tKeys[i], "webcredtype") == "1") then
                        return true;
                    end
                end
            end
            return false;
        else
            return false;
        end
    end
    
    local bMSAccount = bIsOnlineAccount();
    if bMSAccount then
        Dialog.Message("User Account", "Signed in with a Microsoft account");
    else
        Dialog.Message("User Account", "Signed in with a local account");
    end
    Ulrich
    Last edited by Ulrich; 01-24-2018, 06:59 PM.

    Comment


    • #3
      Hi Ulrich,
      Works on my Win 10 X64 with local account signin and also
      on virtual win 10 x64 MS account
      Good Work - I scoured the net with no success (including bat & vbs files)
      Cheers

      Comment


      • #4
        I will give this a test later today on this laptop and on my other one, thanks for the time Ulrich this might help me a lot
        Plugins or Sources MokoX
        BunnyHop 2021 Here

        Comment


        • #5
          I sure got you are signed in to a local account, this does seem to be doing what I want it to do, good catch Ulrich thanks
          Plugins or Sources MokoX
          BunnyHop 2021 Here

          Comment

          Working...
          X