在Active Directory中以编程方式创建通讯组 [英] Programmatically create a Distribution Group in Active Directory

查看:80
本文介绍了在Active Directory中以编程方式创建通讯组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有一个运行Exchange 2007的Windows域,我需要以编程方式创建新的邮件列表。

I have a Windows Domain here that runs Exchange 2007, and I need to programmatically create new Mailing Lists.

到目前为止,我收集到的信息都是Exchange邮件列表只是普通的广告组,所以我主要要担心与广告组的交互。我使用System.DirectoryService命名空间来查询AD,但不确定在此处创建通讯组的正确方法。特别是它必须已启用邮件并显示在Outlook通讯簿中,所以我不知道是否需要调用某种魔术来确保Exchange可以接收新组?

From what I could gather so far, Exchange mailing lists are just normal AD Groups, so I mainly have to worry about the interaction with AD. I used the System.DirectoryService namespace to query AD, but I'm not sure what the correct way would be to create a Distribution Group here. Especially it has to be mail-enabled and show up in the Outlook address book, so I don't know if I need to invoke some magic to make sure Exchange picks up the new group?

是否有指针?

推荐答案

为Exchange创建通讯组列表所需调用的魔术是PowerShell,因此您需要深入了解cmdlet的美好世界。 ;-)

The magic you need to invoke to make a distribution list for Exchange is PowerShell so you'll need to dive into the wonderful world of cmdlets. ;-)

您可以使用 System.DirectoryServices 在Active Directory中创建通讯组(如果需要,则更容易您通过 System.DirectoryServices.AccountManagement 在.NET 3.5上,添加成员等,然后使用 Enable-DistributionGroup -cmdlet可以对组启用邮件。

You can create a distribution group in Active Directory by using System.DirectoryServices (or more easily if you're on .NET 3.5 through System.DirectoryServices.AccountManagement), add members and so on and then use the Enable-DistributionGroup-cmdlet to mail-enable the group.

您还可以使用 New-DistributionGroup -cmdlet。

You could also create the groups and mail-enable them at the same time by using the New-DistributionGroup-cmdlet.

基本上PowerShell cmdlet的作用是在Active Directory组上设置一堆Exchange属性,例如 proxyAddresses 等。您可能不愿意手动设置其中一些(即通过使用System.DirectoryServices),但是有可能您弄错了其中一些。受支持的方式(如Microsoft支持所支持的方式)是通过调用cmdlet。

Basically what the PowerShell cmdlets do is to set a bunch of Exchange-attributes on the Active Directory group such as proxyAddresses and so on. You might get away with setting some of these "manually" (ie by using System.DirectoryServices) but chances are you get some of them wrong. The supported (as in Microsoft Support-supported) way is through calling the cmdlets.

您最好对Google搜索如何从.NET程序中调用PowerShell进行最佳选择(我尚未找到关于它的非常好的文章,但是一旦掌握了它,它就很简单了)- MSDN包含一个示例和一个章节,帮助您入门。

You're probably best off Googling on how to call PowerShell from you .NET program (I haven't found a really good article on it but it's pretty straight-forward once you get the hang of it) - MSDN has a sample and a section to get you started.

这篇关于在Active Directory中以编程方式创建通讯组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆