Hi,
i'm making progress
code:
;---------------------------------------------------------------
; Build Recipient container's adsPath:
; LDAP://myserver/CN=Recipients, OU=Site, O=Org
;---------------------------------------------------------------
$ADsPath = "LDAP://10.40.18.2/cn=Recipients,ou=GISPEN,o=Gispen International BV"
$objCont = GetObject($ADsPath)
;---Create a new MailBox---
$mailBox = $objCont.Create("organizationalPerson", $strAlias)
$mailBox.Put("mailPreferenceOption",0)
$mailBox.Put("givenName", $strFirstName)
$mailBox.Put("sn", $strLastName)
$mailBox.Put("cn", $strDisplayName)
$mailBox.Put("uid", $strAlias)
$mailBox.Put("Home-MTA", $strMTA)
;$mailBox.Put "Home-MDB", strMDB
$mailBox.Put("mail", $strSMTPAddr)
$mailBox.Put("MAPI-Recipient", True)
$mailBox.Put("rfc822Mailbox", $strSMTPAddr)
;--------------------------------------------------------
; Associating to a primary account
; (Requires the ADSI tool kit - REGSVR32 ADSSECURITY.DLL )
;--------------------------------------------------------
$ADS_SID_WINNT_PATH = "5"
$ADS_SID_HEXSTRING = "1"
$sid.SetAs($ADS_SID_WINNT_PATH, "WinNT://GISPEN/$strAlias,user")
$sidHex = $sid.GetAs($ADS_SID_HEXSTRING)
$mailBox.Put("Assoc-NT-Account", $sidHex)
; Commit the property cache to the directory service
$mailBox.SetInfo
? @SERROR
$mailbox = ""
The above code is working until the "Associating to a primary account" part starts. I get an error in expression in : $sid.SetAs($ADS_SID_WINNT_PATH, "WinNT://GISPEN/$strAlias,user")