获取所有邮件群组信息Get-Recipient-PropertySetConsoleLargeSet-ResultSize'1000'-SortByDisplayName-RecipientType'DynamicDistributionGroup','MailNonUniversalGroup','MailUniversalDistributionGroup','MailUniversalSecurityGroup'批量更新以goup为开头的群组所属OU为mailfor/fdelims=%ain('dsquerygroup-limit0-namegroup.*')dodsmove%a-newparentou=mail,dc=env,dc=com更新邮件通讯组的管理者(管理者与邮件组都可以支持多种名称)Set-DistributionGroup-ManagedBy'env.com/Site/env/CN/IT/yang.sun@env.com'-Identity'env.com/Mail/GroupMail/group.eamtest@env.com'查看以group.qlmt开头的组的管理者信息Get-DistributionGroup-Anrgroup.qlmt|Format-TableName,ManagedBy按规范导出数据Get-Mailbox|selectname,emailaddresses|Export-Csvc:\test.csv批量更新联系人所属OU为contactfor/fdelims=%ain('dsquerycontact')dodsmove%a-newparentou=contact,ou=mail,dc=env,dc=com新建邮箱群组new-DistributionGroup-Name'group.alias@env.com'-OrganizationalUnit'env.com/Mail/GroupMail'-SamAccountName'显示名称2000'-DisplayName'显示名称'-Alias'group.alias'-ManagedBy'yang.sun'批量新建邮箱群组$cn=@env.com$ou=env.com/Mail/GroupMailImport-Csvnewgroupmail.csv|foreach-Object{new-DistributionGroup-DisplayName$_.Display-SamAccountName$_.Name-Name($_.Name+$CN)-Alias$_.Name-ManagedBy$_.ManageBy-OrganizationalUnit$ouset-DistributionGroup-Identity($_.Name+$CN)-EmailAddressPolicyEnabled$false-EmailAddresses($_.Name+$CN)-RequireSenderAuthenticationEnabled($_.Auth-eqYES)}更新邮件群组的所有信息set-DistributionGroup-Identitygroup.alias@env.com-Name'group.newalias@env.com'-EmailAddressPolicyEnabled$false-SamAccountName'new显示名称2000'-DisplayName'new显示名称'-Alias'group.newalias'-ManagedBy'dan.chen'-EmailAddresses'group.newalias-e@env.com'批量更新邮件群组的所有信息Import-Csv($x+$fn)|foreach-Object{set-DistributionGroup-Identity($_.OldName+$CN)-Name($_.NewName+$CN)-SamAccountName$_.NewName-DisplayName$_.Display-Alias$_.NewName-ManagedBy$_.ManageBy-EmailAddressPolicyEnabled$false-EmailAddresses($_.NewName+$CN)-RequireSenderAuthenticationEnabled($_.Auth-eqYES)import-csvd:\change.csv|foreach-object{set-distributiongroup-identity$_.name-name($_.ad+@env.com)-EmailAddressPolicyEnabled$false-samaccountname$_.ad-alias$_.ad-emailaddresses($_.ad+@env.com)}添加邮件群组成员Add-DistributionGroupMember-IdentityStaff-MemberJohnEvans@contoso.com更新邮件群组成员Update-DistributionGroupMember-IdentityResearchReports-Membersjohn@contoso.comGet-DistributionGroupMember-IdentityMarketingUSARemove-DistributionGroupMember-IdentityTechnicalSupport-MemberJanDryml源文档(v=exchg.141).aspx更新邮件群组发送权限Set-DistributionGroup-BypassSecurityGroupManagerCheck-AcceptMessagesOnlyFromSendersOrMembers'env.com/Site/env/CN/IT/yang.sun@env.com'-RequireSenderAuthenticationEnabled$false-Identity'env.com/Mail/GroupMail/group.cnbj@env.com''env.com/Site/env/CN/SU/plm.support@env.com','env.com/Site/env/CN/EHS/jingyun.zhou','env.com/Site/env/CN/IT/fred.wang','env.com/Site/env/CN/CEO/l.zhang@env.com','env.com/Site/env/CN/SU/staff.committee@env.com','env.com/Site/env/CN/ADMIN/yanping.huang','env.com/Site/env/CN/SRD/shibing.xia','env.com/Site/env/CN/ADMIN/juan.shen','env.com/Site/env/CN/ADMIN/qianlu.shu','env.com/Disabled/account/fei.xu@env.com','env.com/Site/env/CN/SB/alex.sun','env.com/Site/env/CN/IT/lawrence.gong','env.com/Site/env/CN/HR/xiaoling.que','env.com/Site/env/CN/TQ/clear.shi','env.com/Site/env/CN/TQ/derek.xie','env.com/Site/env/CN/HR/zhihong.wang','env.com/Site/env/CN/HR/jerry.luo','env.com/Site/env/CN/ADMIN/li.zhang','env.com/Site/env/CN/IT/dan.chen','env.com/Site/env/CN/OM/grace.lu','env.com/Site/env/CN/IPD/silvia.xie','env.com/Site/env/CN/ADMIN/xiaojun.zhao','env.com/Site/env/CN/ADMIN/canhong.zhong','env.com/Site/env/CN/SRD/jian.feng','env.com/Site/env/CN/HR/jing.peng','env.com/Site/env/CN/HR/hua.chu','env.com/Site/env/CN/OMS/gang.chen','env.com/Site/env/CN/GOV/hongwen.zhou','env.com/Site/env/CN/EHS/sihua.fu','env.com/Site/env/CN/TQ/dong.wei','env.com/Site/env/CN/OMS/jin.sheng','env.com/Site/env/CN/ADMIN/ya.bai','env.com/Site/env/CN/EHS/shaohua.cao','env.com/Site/env/CN/CEO/james.sun','env.com/Site/env/CN/Finance/jing.xu'邮箱群组属性对照表模板E是否新建时必填项E是否可重复Exchange注册字段Exchange显示字段说明AD显示字段AD注册字段group.alias@env.comYESNOName无Name参数指定ActiveDirectory用户和计算机中以及Exchange管理控制台的“组名”字段中的通讯组名称。名称为中文时unixattribute字段会现错误信息显示名称2000YESNOSamAccountName无如果未指定Alias参数,则满足下列条件:组名2000以前版本•SamAccountName参数的值用于Alias参数的值,其中所有空格均转换为下划线。•SamAccountName参数(所有空格均转换为下划线)用于生成对象的主SMTP电子邮件地址。group.aliasNONOAlias别名Alias参数指定通讯组的别名。Alias参数用于生成对象的主SMTP电子邮件地址。Alias参数的值不能包含空格。如果没有指定Alias参数,则使用SamAccountName参数的值生成主SMTP电子邮件地址,其中所有空格均转换为下划线。无env.com/Mail/GroupMailNOYESOrganizationalUnit组织单元指定群组所在的管理单元无显示名称NOYESDisplayName显示名如果Name和DisplayName参数的值不同:无DisplayName参数指定Exchange管理控制台和Exchange全局地址列表(GAL)中的通讯组名称。alias_onlychar@env.comNOYESsmtp主SMTP地址默认由alias+env.com组成电子邮件Yang.sunNONOManagedBy指定管理者无DistributionNONOTypeType参数指定在ActiveDirectory中创建的组类型。组的作用域始终为通用。有效值为Distribution或Security。类型描述