This was the whole snippet, basically it is grabbing the SID of an AD user to associate the mailbox to an account...
'get the SID for the account to be associated with the new mailbox
Set objSid = CreateObject("ADsSID")
objSid.SetAs ADS_SID_WINNT_PATH, "WinNT://" & strDomain & "/" & strUserID
strSidHex = objSid.GetAs(ADS_SID_HEXSTRING)
later on...
objMailbox.Put "Assoc-NT-Account", strSidHex
yea, I had a feeling that was it...unfortunately, the links to download ADSI 2.5 no longer work, and I can't find that dll anywhere else yet. Guess I'll keep looking. Stupid Exch 5.5....
[1]>yea, I had a feeling that was it...
Now, but if you cannot get hold of a helper com object, you are not bound to rely on that particular helper. Not only you can look for another person's similar helper control out there, you have to concentrate on what result you want to get! The rest is the smoke.
[2] You can simply replace that block with adssid by some script without it.
[tt]
'get the SID for the account to be associated with the new mailbox
Set objSid = CreateObject("ADsSID")
objSid.SetAs ADS_SID_WINNT_PATH, "WinNT://" & strDomain & "/" & strUserID
strSidHex = objSid.GetAs(ADS_SID_HEXSTRING) [/tt]
[2.2] My replacement script would be something like this.
[tt]
'get the SID for the account to be associated with the new mailbox
dim ossid
ossid=getobject(WinNT://" & strDomain & "/" & strUserID).objectsid
strSidHex=""
for i=0 to ubound(ossid)
sbyte=right("0" & hex(ascb(midb(ossid3,i+1,1))),2)
strSidHex=strSidHex & right("0" & hex(ascb(midb(ossid3,i+1,1))),2)
next
'strSidHex has done and is ready to be used.
[/tt]
Amendment
I've got a typo slipped in (ossid3 should be read ossid). This is a relist.
[2.2'] My replacement script would be something like this.
[tt]
'get the SID for the account to be associated with the new mailbox
dim ossid
ossid=getobject(WinNT://" & strDomain & "/" & strUserID).objectsid
strSidHex=""
for i=0 to ubound(ossid)
sbyte=right("0" & hex(ascb(midb(ossid,i+1,1))),2)
strSidHex=strSidHex & right("0" & hex(ascb(midb(ossid,i+1,1))),2)
next
'strSidHex has done and is ready to be used.
[/tt]
ads.dll is registred (Microsoft MTS East)
ads.dll has the benefit of finding nested membership without the need for recursive group search, well sort of, it seems to be fairly efficient. i personally have never used it, someone else here used it in the code below
Set objSysInfo = CreateObject("ADSystemInfo")
Set objInfo = GetObject("LDAP://" & objSysInfo.ComputerName)
objInfo.GetInfoEx ARRAY("tokengroups"),0
grps = objInfo.Get("tokengroups")
Set objCvrt = CreateObject("ADs.ArrayConvert")
For i = lbound(grps) to ubound(grps)
j = grps(i)
hexSid = objCvrt.CvOctetStr2vHexStr(j)
bindSid = "LDAP://<SID=" & hexSid & ">
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.