Kā iegūt GUID objektu no pakalpojuma Active Directory

Kopsavilkums

Šis raksts parāda kā pārvērst tās virknes veidā heksadecimālo virknes formu objekta GUID:

  1. Ielīmējiet šādu kodu VBS failu.

    '================================================================'Set the next line to reflect a DN for an object in the directory'================================================================Set obj = GetObject("LDAP://CN=Username,CN=Users,DC=DOMAIN,DC=COM")MsgBox "The GUID string Value for user " & obj.Get("DisplayName") & _       " is " &  ConvertHexStringGUIDToStringGUID(obj.GUID)'================================================================' ConvertHexStringGUIDToStringGUID function'================================================================Function ConvertHexStringGUIDToStringGUID(strOctet)    Dim tmpGUID, GUIDStr    'Convert the string by flipping the bits around.    GUIDStr = Mid(strOctet, 7, 2)    GUIDStr = GUIDStr + Mid(strOctet,  5, 2)    GUIDStr = GUIDStr + Mid(strOctet,  3, 2)    GUIDStr = GUIDStr + Mid(strOctet,  1, 2)    GUIDStr = GUIDStr + Mid(strOctet, 11, 2)    GUIDStr = GUIDStr + Mid(strOctet,  9, 2)    GUIDStr = GUIDStr + Mid(strOctet, 15, 2)    GUIDStr = GUIDStr + Mid(strOctet, 13, 2)    GUIDStr = GUIDStr + Mid(strOctet, 17, Len(strOctet))    tmpGUID = "{" & Mid(GUIDStr,  1,  8) & "-" & Mid(GUIDStr,  9, 4) & _              "-" & Mid(GUIDStr, 13,  4) & "-" & Mid(GUIDStr, 17, 4) & _              "-" & Mid(GUIDStr, 21, 15) & "}"    ConvertHexStringGUIDToStringGUID = tmpGUIDEnd Function
  2. Palaidiet skriptu.

Vai nepieciešama papildu palīdzība?

Paplašiniet savas prasmes
Iepazīties ar apmācību
Esiet pirmais, kas saņem jaunās iespējas
Pievienoties Microsoft Insider

Vai šī informācija bija noderīga?

Paldies par jūsu atsauksmēm!

Paldies par atsauksmēm! Šķiet, ka jums varētu būt noderīgi sazināties ar kādu no mūsu Office atbalsta speciālistiem.

×