检索通讯组列表

时间:2016-11-10 18:34:06

标签: powershell exchange-server

我需要检索具有x400和x500地址的通讯组列表。我已确定属性是proxyaddresses和TextEncodedORAddress。我们正在运行Exchange 2013.当我查看高级搜索库时,例如" OU = Exchange,OU =公司,DC =公司,DC = com"并使用Get-ADUser它返回用户帐户,但我需要分发组 使用以下命令返回具有我需要的属性的用户,但我需要通讯组,而不是用户。

Get-ADUser -SearchBase "OU=Exchange,OU=company,DC=company,DC=com" `
-Filter * -Properties * | Select * |
FT CN,distinguishedName,proxyaddresses,textEncodedORAddress

我尝试了Get-Mailbox,Get-DistributionGroup,但是我收到一条错误,说它不是cmdlet。我也尝试使用属性groupType进行过滤,但它没有用。我不确定我是否能够使用Get-ADObject,因为我不太确定我是如何使用该cmdlet的。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

get-adgroup -filter "GroupCategory -eq 'Distribution'"

答案 1 :(得分:0)

因为proxyaddresses中有多个值,所以我收到了Microsoft.ActiveDirectory.Management.ADPropertyValueCollection,因此我不得不使用以下内容。

Get-ADGroup -SearchBase "OU=Exchange,OU=Company,DC=company,DC=com" `
-Filter * -Properties proxyAddresses | Select CN,distinguishedName,textEncodedORAddress,`
@{L=’ProxyAddress_1′; E={$_.proxyaddresses[0]}},
@{L=’ProxyAddress_2′; E={$_.ProxyAddresses[1]}},
@{L=’ProxyAddress_3′; E={$_.proxyaddresses[2]}},
@{L=’ProxyAddress_4′; E={$_.proxyaddresses[3]}},
@{L=’ProxyAddress_5′; E={$_.proxyaddresses[4]}}|
Export-CSV C:\temp\x500_Export.csv

我唯一无法弄清楚的是输出,这就是为什么我会看到各种proxyaddresses和distinguishedname,但它不会显示CN或displayname。这些都是空白的。