SID against User Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I find User Name if I have user's SID and also user's SID if I have
User Name.
 
How can I find User Name if I have user's SID and also user's SID if I have
User Name.


See tip 5471 » SidToName freeware Will decode a SID at a specified machine into a user-friendly username.
in the 'Tips & Tricks' at http://www.jsifaq.com

See tip 5345 » How can I get a user's SID in a batch file?

See tip 0519 » Everyone can find your renamed administrator.

See tip 8280 » What is the SID of built-in domain accounts?


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
***Lines that dont begin with 2 spaces have wrapped accidentally***


@echo off
for /l %%i in (1,1,12) do echo.
set /p user_name=Enter Username:
cls
reg query "HKLM\software\microsoft\windows nt\currentversion\profilelist"
/s >>"%temp%\reg_sid.txt"
findstr /n /i %user_name% "%temp%\reg_sid.txt">>"%temp%\sid_number.txt"
for /f "tokens=1 delims=:" %%i in (%temp%\sid_number.txt) do set
line_num=%%i
set /a line_num=%line_num% - 2
for /f "skip=%line_num% tokens=7 delims=\" %%i in (%temp%\reg_sid.txt) do
set sid=%%i &cls& goto :continue
:continue
if not %errorlevel%==0 set sid=Unable to find the username: %user_name%
for /l %%i in (1,1,12) do echo.
echo %sid:~0,-1%
for /l %%i in (1,1,11) do echo.
pause
del "%temp%\reg_sid.txt"
del "%temp%\sid_number.txt"


***Lines that dont begin with 2 spaces have wrapped accidentally***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Will SID for a user always be the same? 1
SID Question 1
Scripting Local Security Policy Changes 0
Identifying what Object Belongs to a SID 1
SID 1
List SIDs ... 1
SID problems 1
SID Enumeration Problem 1

Back
Top