Reputation: 85
This has probably been answered before, but I can't find anything to help for the life of me. We have different systems, and some of the older ones have a different AD guids for the same person when compared to newer systems. The guids look similar, but are different. This is causing a big problem in a new app I am doing that is reading a SQL database form and older and newer app. Here is an example, and older one is this: 147e2a1e-579e-a143-88b9-d3a8ee00e609
and a newer one is this 1e2a7e14-9e57-43a1-88b9-d3a8ee00e609
. If I read AD with .NET it gives me the "newer" guid. What is the cause of this, and what can I do to fix it?
Upvotes: 2
Views: 385
Reputation: 56
I have seen this problem before. It is caused by the way different tools interpret the bits in AD differently. I bet you can convert one to the other by swapping things around. You just need to figure out the algorithm. I wrote some code that fixed something similar in one instance, may not be exactly what will fix yours, but should get you on the right path.
Private Shared Function SymmetricConversion(source As Guid) As Guid
Dim sourceStr = source.ToString()
Dim sb = New System.Text.StringBuilder()
'group 1
sb.Append(sourceStr.Substring(6, 2))
sb.Append(sourceStr.Substring(4, 2))
sb.Append(sourceStr.Substring(2, 2))
sb.Append(sourceStr.Substring(0, 2))
sb.Append(sourceStr.Substring(8, 1))
'group 2
sb.Append(sourceStr.Substring(11, 2))
sb.Append(sourceStr.Substring(9, 2))
sb.Append(sourceStr.Substring(13, 1))
'group 3
sb.Append(sourceStr.Substring(16, 2))
sb.Append(sourceStr.Substring(14, 2))
'groups 4 and 5
sb.Append(sourceStr.Substring(18, sourceStr.Length - 18))
Dim resultStr = sb.ToString()
Dim result = New Guid(resultStr)
Return result
End Function
Upvotes: 4