ADSI & Exchange. Не включается мессенджер

Тема в разделе ".NET", создана пользователем fedor_zuev, 5 фев 2005.

Статус темы:
Закрыта.
  1. fedor_zuev

    fedor_zuev Гость

    Есть задача,создать пользователя в Active Dir,создать ему майл и включить инстант мессенджер. Имеем решение -
    -==============================================
    Dim UserType, ULogin As String
    Dim RootDSE As ActiveDs.IADs
    Dim User As ActiveDs.IADsUser
    Dim Domain As ActiveDs.IADs
    Dim CorpOu As ActiveDs.IADsContainer
    Dim TargetPath As String
    Dim UserDisplayName, UserFirstname, UserLastName As String
    Dim Flag, NewFlag As VariantType
    Dim msExchIMVirtualServer, homeMTA, HomeMTB, HomeDrive, mail, msExchHomeServerName As String
    Dim msExchIMAddress, msExchIMMetaPhysicalURL, msExchIMPhysicalURL As String
    Dim proxyAddresses, profilePath As String



    TargetPath = "ou=ForTest"
    RootDSE = GetObject("LDAP://RootDSE")
    Domain = GetObject("LDAP://" & RootDSE.Get("defaultnamingcontext")
    CorpOu = GetObject("LDAP://" & TargetPath & "," & Domain.distinguishedname)
    MsgBox("LDAP://" & TargetPath & "," & Domain.distinguishedname, MsgBoxStyle.OKOnly, "Debug")
    UserDisplayName = TextBox1.Text
    UserFirstname = TextBox1.Text
    UserLastName = TextBox2.Text
    ULogin = TextBox4.Text
    HomeDrive = "L:"
    profilePath = ""
    HomeMTB = "CN=Common Mailbox Store (MAILSERVER),CN=First Storage
    Group,CN=InformationStore,CN=MAILSERVER,CN=Servers,CN=First Administrative Group,CN=Administrative
    Groups,CN=Alpha,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=alpha-pc,DC=com"
    homeMTA = "CN=Microsoft MTA,CN=MAILSERVER,CN=Servers,CN=First Administrative Group,CN=Administrative
    Groups,CN=Alpha,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=alpha-pc,DC=com"
    msExchHomeServerName = "/o=Alpha/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=MAILSERVER"
    msExchIMVirtualServer = "CN=1,CN=RVP,CN=Protocols,CN=MAILSERVER,CN=Servers,CN=First Administrative
    Group,CN=Administrative Groups,CN=Alpha,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=alpha-pc,DC=com"
    msExchIMAddress = ULogin & "@alpha-pc.com"
    msExchIMMetaPhysicalURL = "http://im.alpha-pc.com/instmsg/aliases/" & ULogin
    msExchIMPhysicalURL = "http://im.alpha-pc.com/instmsg/local/im.alpha-pc.com/instms"
    proxyAddresses = "smtp:" & ULogin & "@alpha-pc.com"
    mail = ULogin & "@alpha-pc.com"
    User = CorpOu.Create("user", "cn=" & UserDisplayName)
    User.Put("sAMAccountName", TextBox1.Text)
    User.Put("userPrincipalName", ULogin)
    User.EmailAddress = ULogin & "@alpha-pc.com"
    User.SetInfo()
    User = GetObject("LDAP://cn=" & UserDisplayName & "," & CorpOu.distinguishedname)
    User.AccountDisabled = False
    User.SetPassword("1234567")
    'User.Put("pwdLastSet", "0")
    Flag = User.Get("UserAccountControl")
    NewFlag = Flag Or 0
    User.Put("UserAccountControl", NewFlag)
    User.Put("DisplayName", UserDisplayName)
    User.Put("GivenName", UserFirstname)
    User.Put("SN", UserLastName)
    User.Put("HomeDrive", HomeDrive)
    User.Put("homeDirectory", "\\termserver\userfolders\")
    User.Put("mail", mail)
    User.Put("mailNickName", ULogin)
    User.Put("msExchHomeServerName", msExchHomeServerName)
    User.Put("homeMTA", homeMTA)
    User.Put("proxyAddresses", proxyAddresses)
    User.Put("homeMDB", HomeMTB)
    User.Put("msExchIMVirtualServer", msExchIMVirtualServer)
    User.Put("msExchIMMetaPhysicalURL", msExchIMMetaPhysicalURL)
    User.Put("msExchIMPhysicalURL", msExchIMPhysicalURL)
    User.Put("msExchIMAddress", msExchIMAddress)
    User.SetInfo()
    -==============================================
    В АД пишется - мессенджер енэйблт всё ок - вот только шиш,ни фига он не енэйбл зати в него никак. Почтовый ящик создаётся через раз в прямом смысле,при одном запуске создаётся - а при другом -нет. Если есть мысли поделитесь плиз.
    З.Ы. Огромная просьба не умничать и не отсылать ни в ADSI SDK Help,ни на msdn.com,ибо руководствуюсь принципом - I will ask google before asking dumb questions - Заранее большое спасибо
     
Загрузка...
Статус темы:
Закрыта.

Поделиться этой страницей