In Windows environment, each user is assigned a unique identifier called Security ID or SID, which is used to control access to various resources like Files, Registry keys, network shares etc. We can obtain SID of a user through WMIC USERACCOUNT command. Below you can find syntax and examples for the same.
Get SID of a local user
wmic useraccount where name=’username’ get sid
Get SID for current logged in user
wmic useraccount where name=’%username%’ get sid
Find username from a SID
wmic useraccount where sid=’S-1-3-12-1234525106-3567804255-30012867-1437′ get name