Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8345449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:40:32+00:00 2026-06-09T06:40:32+00:00

I’ve been asked to export a list of users from ActiveDirectory, and Convert the

  • 0

I’ve been asked to export a list of users from ActiveDirectory, and Convert the GUIDs to a numeric equivalent for display (so I’ll .ToString that after). I’ve done some searching but most of the questions are on converting something TO a GUID, or converting a GUID to Int or something silly, (I understand Ints are too small etc..), which arn’t really appropriate.

I have the AD stuff sorted and the data exported, however I’m wondering what data type / format to use to convert the GUIDs to, and if it is even possible. I’m not really bothered what exact numeric type is used, as long as the number is still “unique” (I understand that GUIDs arn’t really unique etc..).

Are GUIDs in hex based format, and is there any suitable numeric type I can convert them to for display?

I’m using VB.Net and .Net Framework 4. I’ve tried using BigInteger, but that seems to go into negative numbers too, which I’ll use if I have to, but would rather not if there’s something else more suitable.

Edit
Here’s what I tried:

Using a GUID of: f02c7caf-7e5a-491b-9f23-9476174bdda1

And this code:

Dim Foo As String = (New System.Numerics.BigInteger(adUserDirectoryRecord.Guid.ToByteArray())).ToString

It came out as:
-125127638954164478915246035839554388817

Note: I’ll be outputting this in .csv format once I’m done, for another team to pick up and import into another system, this is likely why they want it in numeric rather than alphanumeric format.

SOLUTION:

As there will be no need to ever convert the Numeric GUID back, BigInteger was the correct method to use for this. The change was to Resize the ByteArray to force it to Positive values only:

'Gets the User's GUID from the Active Directory record, converts it to a Byte Array and Resizes it to Force Positive Values Only:
Dim bytGUIDBytes As Byte() = adUserDirectoryRecord.Guid.ToByteArray()
Array.Resize(bytGUIDBytes, 17)

'Converts the User's GUID Bytes into a Numeric Equivalent, and Returns the String version of the Numerical value.
Return New System.Numerics.BigInteger(bytGUIDBytes).ToString
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:40:33+00:00Added an answer on June 9, 2026 at 6:40 am

    “Numeric” doesn’t make sense in VB w.r.t Guid. There is no 128-bit numeric types in .net. The only 128-bit type is Decimal; but that doesn’t seem to make sense to convert a Guid to a Decimal. I would simply use ToByteArray and display the byte values as hex.

    Alternatively, make sure the last byte in the array given to BigInteger is zero to get a postive value. e.g.::

    var bytes = Guid.NewGuid().ToByteArray(); 
    Array.Resize(ref bytes, 17); 
    var bigInt = new BigInteger(bytes);
    var value = bigInt.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.