Read attribute msExchMailboxGuid to string

Started by NotThatSteve, June 05, 2015, 06:45:09 AM

Previous topic - Next topic

NotThatSteve

I am using dsGetProperty to get the values of multiple Active Directory attributes of user objects.  Most of the return usable strings but msExchMailboxGuid returns 16 numbers instead of the GUID.  Is there a function to easily convert this to a string?  Otherwise is there a better function in winbatch to get that value into a string? 

Thanks in advance!

td

The 'msExchMailboxGuid' property is an octet string type in AD's schema.  The extender defaults to returning octet string properties as a space delimited list of byte value. The extender does maintain a table of properties that it will convert from octet string to other representations but this property isn't one of them so it uses the default representation. 

There are multiple ways to obtain the string GUID representation from a  list. Here is but one:
Code (winbatch) Select
AddExtender("wilx44i.dll",0,"wilx64i.dll")
strOctet = '0 170 197 107 205 68 17 208 140 194 0 192 79 194 149 238'
nMax = ItemCount(strOctet, ' ')
strGuid = "{"
for i = 1 to nMax 
   strGuid := StrFixLeft(xBaseConvert(ItemExtract(i, strOctet, ' '), 10, 16), '0', 2)
   if i == 4 || i == 6 || i == 8 || i == 10 then strGuid := '-'
next
strGuid := '}'

Message( "String Guid", strGuid)
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

NotThatSteve

Excellent.  That put me on the right track.  I appreciate your quick help.