Get SID from Username and Username from SID using WMI Queries

Introduction This post will show you how to get the username of a SID. This will help you when you need to make amendments within a computers registry for HKEY_CURRENT_USER (HKCU). Guide Open a command prompt on the computer that a change is required for and run the followinng command: wmic useraccount get name, sid, […]

Get Sid From Username And Username From Sid Using WMI Queries

Introduction

This post will show you how to get the username of a SID. This will help you when you need to make amendments within a computers registry for HKEY_CURRENT_USER (HKCU).

Guide

Open a command prompt on the computer that a change is required for and run the followinng command:
wmic useraccount get name, sid, status
This will now look into the computers WMI and provide you with a list of SIDs and their user account name. If you have many SIDs and user accounts on one machine, then you can scale the search down by using the following command instead:
wmic useraccount where name='username' get name, sid, status
where;
  • username‘ = the username of the SID you are trying to find.
You can also reverse this query and use the SID to get the username by running this command:
wmic useraccount where sid='S-1-5-11-1111111111-111111111-1111111111-1111' get name
where;
  • S-1-5-11-1111111111-111111111-1111111111-1111‘ = the SID of the username you are trying to find.

Questions and Feedback

If you have any questions or feedback on this post, please feel free to leave us a message below and we will get back to you as soon as we can.
🛠️

Gear We Recommend

A few general tech accessories worth having alongside this.

Browse our General Tech Accessories picks on Amazon

As an Amazon Associate, TechyGeeksHome earns from qualifying purchases.


Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.