如何使用VB.net邮件启用广告组
我用VB编写了一个程序,使用GroupPrincipal创建Active Directory组,并根据需要使用用户或其他组填充它们 有谁能给我指点一下如何通过相同的程序在我们的exchange2010服务器上启用这些组邮件吗 我在谷歌上看到了一些可以在服务器上运行的powershell,但我需要我的程序在创建这些组时自动启用它们 希望有人能让我走上正轨。如何使用VB.net邮件启用广告组,vb.net,active-directory,exchange-server-2010,Vb.net,Active Directory,Exchange Server 2010,我用VB编写了一个程序,使用GroupPrincipal创建Active Directory组,并根据需要使用用户或其他组填充它们 有谁能给我指点一下如何通过相同的程序在我们的exchange2010服务器上启用这些组邮件吗 我在谷歌上看到了一些可以在服务器上运行的powershell,但我需要我的程序在创建这些组时自动启用它们 希望有人能让我走上正轨。 Pete.私有子CreateDistributionList Dim ad As DirectoryEntry Dim co
Pete.私有子CreateDistributionList
Dim ad As DirectoryEntry
Dim contacts As DirectoryEntry
Dim entry As DirectoryEntry
' Create a conntaction to Active Directory
ad = New DirectoryEntry("LDAP://MACHINENAME/DC=DOMAIN,DC=COM", "username", "password")
' Find the OU to create the contact in
contacts = ad.Children.Find("OU=Distrubtion Lists")
' Create AD object
entry = contacts.Children.Add("CN=LastName\, FirstName", "group")
' Fill out basic attributes
entry.Properties("groupType").Value = 8 ' 8 = Universal Group
entry.Properties("displayName").Value = "Name"
entry.Properties("sAMAccountName").Value = "Name" ' I don't know if this is required
entry.Properties("mail").Value = "EmailAddress@Something.com"
entry.Properties("telephoneNumber").Value = "555-555-5555"
entry.Properties("description").Value = "description"
' The follow attributes I believe to be the ones required for mail enabling
' (though I have not testing thoroughly to pinpoint exactly what is required)
' SMPT MUST be capitalized
entry.Properties("targetAddress").Value = "SMTP:EmailAddress@Something.com"
entry.Properties("proxyAddresses").Value = New Object() {"SMTP:EmailAddress@Something.com"}
' To find the legacyExchangeDN, copy value from an existing contact
entry.Properties("legacyExchangeDN").Value = ""
' mailNickName can not have spaces
entry.Properties("mailNickName").Value = New String("FirstNameLastName").Replace(" ", "")
' Commit Changes to Active Directory
entry.CommitChanges()
' Close connections to Active Directory
entry.Close()
ad.Close()
End Sub
在发布答案时,您还应该解释代码是如何解决问题的