I have a situation where I need to store a globally unique identifier that points to an Active Directory user account. I'm leaning towards th开发者_C百科e Guid because it is easier to store than the Sid.
According to the MSDN entry, the property (which is a Nullable), will always return null if the ContextType is set to "Machine." I don't need to worry about this because our ContextType will always be set to "Domain."
My question is, will this property ever return null if the ContextType is "Domain"? In other words, will an account in an AD DS store always have a Guid?
I saw this after answering a related question, and the answer is yes: every object will have a GUID, this is outlined at
http://msdn.microsoft.com/en-us/library/ms675579.aspx
where the documentation on schemaIDGuid says "On creation of the classSchema object, the Active Directory server generates this value if it is not specified. If you create a new class, generate your own GUID for each class so that all installations of your extension use the same schemaIDGUID to refer to the class."
so....if you dont create one, AD will do it for you.
I don't have a definitive answer, but I wrote a simple console app that ran through all our Active Directory user accounts.
For us, at least, the answer is no. The Principal will always have a Guid, so long as the ContextType is "Domain"
精彩评论