"=?Utf-8?B?TXIgSw==?=" <MrK RemoveThis @discussions.microsoft.com> wrote in
news:A37F76B2-7199-4EE7-8828-201CB5D2286E@microsoft.com:
> The page you supplied has a VB example but the problem is that things
> do not seem so straight forward with VBScript.
>
> If I run the following script the output is a bunch of question
> marks...
>
> ADGroup = InputBox("I.E. F00-SQLSERVERENTMGR-2000", "Please enter
> Active Directory group", "F00-SQLSERVERENTMGR-2000")
>
> Set objGroup = GetObject("LDAP://CN=" & ADGroup &
> ",OU=Applications,OU=Users and Groups,DC=f00bar,DC=f00")
>
> WScript.Echo objGroup.objectGUID
> Set GUID = objGroup.objectGUID
>
This function takes an AdsPath (i.e. full
LDAP:// or
WinNT:// path of the
object) and returns the GUID is readable format. Watch for line
wrapping.
HTH,
Wayne
Function GetGUID(theObject)
GUID = GetObject(theObject).Get("objectGUID")
strGUID = ""
For x = LBound(GUID) to UBound(GUID)
strGUID = strGUID & Right("00" & Hex(AscB(MidB(GUID, x+1))),2)
Next
vvvvvvvv = BigEndian(Mid(strGUID,1,

)
wwww = BigEndian(Mid(strGUID,9,4))
xxxx = BigEndian(Mid(strGUID,13,4))
yyyy = Mid(strGUID,17,4)
zzzzzzzzzzz = Mid(strGUID,21)
GetGUID = "{" & lcase(vvvvvvvv & "-" & wwww & "-" & xxxx & "-" & yyyy
& "-" & zzzzzzzzzzz) & "}"
End Function
' Flips the bytes in a string of bytes from little endian to big endian
format
' and converts to decimal
Function BigEndian(theBytes)
BigEndian = ""
For x = Len(theBytes) To 2 step -2
BigEndian = BigEndian & Mid(theBytes,x-1,2)
Next
End Function
>> Stay informed about: Retrieving an object's GUID as a string from Active Direct..