Get the SID of currently enrolled user from Registry

Bevan Thomas 20 Reputation points
2024-06-13T10:44:34.02+00:00

Hi,
Is there a way I can get the SID of a currently enrolled user from registry.
I found this Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments\499B59E9-637E-493D-91D8-9A5FE2D5B450 registry key which contains the SID.
But I somehow also have another 8FB7D64E-70FC-4F9D-89EE-D486817534DF, which also contains some enrollment details of some other user.
Is there a way I can distinguish between them?

With regards
Bevan

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,575 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,604 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
5,053 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bevan Thomas 20 Reputation points
    2024-06-13T20:43:19.94+00:00

    Hey, so consider like I am logged into some user and I don't know which user enrolled the device, is there a way I can find the SID of the user that enrolled the device

    0 comments No comments

  2. Xenia-MSFT 2,260 Reputation points Microsoft Vendor
    2024-06-14T02:29:35.4233333+00:00

    @Bevan Thomas Thanks for posting in our Q&A.

    For this issue, we can see the enrolled user account in Settings > Accounts > Access work or school. We can run the following commend in PowerShell to find the target Azure AD user's objectID.

    Install-Module AzureAD
    
    connect-AzureAD
    
    Get-AzureADUser
    
    

    Then we can refer to the following link to covert Azure AD objectID to SID.

    https://oliverkieselbach.com/2020/05/13/powershell-helpers-to-convert-azure-ad-object-ids-and-sids/

    Note: Non-Microsoft link, just for the reference.

    Hope it will help.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.