• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2463
  • Last Modified:

Convert Hex SID to Dec SID

I have a quick but relatively complex question
Environment - Native Mode, Win 2000 Active Directory.
I am looking for a method to convert an active directory HEX value of a User's SID into is Decimal value
For example a user account value in the registry can be displayed as S-1-5-21-1390067357-484763869-1801674531-3404 as it's Decimal value or 15 15 52 da be 9d 1c e4 e8 dd 6b 63 5f 23 d4 c as it's HEX Value.
What I would like to achieve is a way to convert between the 2, using script. That way I can setup a scrip to 1st Poll a resource to gain the HEX value of a SID and then resolve that to the DEC value so that I can compare it against another Resource.
If there is any function in either VBScript, WMI, WSH or ADSI that would be beneficial.
1 Solution
I'd be difficult to represent the HEX version of a SID in a script in anything other than a string.   Where are you getting this SID from?

I'd be a rather simple task to write a small application that translated a string of hex values into a SID-formated string.  I'll write you one...
Try those for starters:

Platform SDK: Security      -- SID Components

Platform SDK: Security      -- Converting a Binary SID to String Format in C++

HOWTO: Use Microsoft Visual Basic to Convert a Raw SID into a String SID

HOWTO: Convert the SDDL form of an SID to a SAM Account Name

How do I convert a SID between binary and string forms?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now