Exchange 配布グループのメモを取得する

Exchange 配布グループのメモを取得する

特定の配布グループのノートを取得し、配布グループの名前やその他の情報とともに出力するためのワンライナーを構築したいと考えています。Google で検索したところ、すべて同じソリューションを持つさまざまなソースが見つかりました。私が見つけたソリューションは次のとおりです。

Get-DistributionGroup Head-of-Operations | Select-Object Name, GroupType, ManagedBy, @{Name="Notes";Expression={(Get-Group $_).Notes}}

これはその情報源の 1 つです:

https://richgski.blogspot.com/2012/03/powershell-get-exchange-distribution.html

しかし、メモの行は常に空白のままになりますが、その理由はわかりません。

Name        GroupType ManagedBy Notes
----        --------- --------- -----
Head-of-Ops Universal {}

次のコマンドを別途実行すると:

Get-Group Head-of-Ops | Select-Object Notes

... 出力として正しいメモが表示されます:

Notes
-----
Owner- Paul J.

もう少し試してみました。次のコードは完璧に動作しています。

$Result = Get-DistributionGroup Head-of-Operations
Get-Group $Result.Name | Select-Object Notes

出力:

Notes
-----
Owner- Paul J.

しかし、これはまだ動作しません。エラーなしで実行されますが、Notes はまだ空白です。

Get-DistributionGroup Head-of-Operations | Select-Object Name,GroupType,ManagedBy,@{Name="Notes";Expression={(Get-Group $_.Name | Select-Object Notes)}}

出力:

Name        GroupType ManagedBy Notes
----        --------- --------- -----
Head-of-Ops Universal {}

その後、このトピックに関する別の投稿をここで見つけました: https://www.oxfordsbsguy.com/2014/04/21/exchange-powershell-how-to-enumerate-distribution-lists-managers-and-members/#comment-4452

それでも、次のコマンドを使用します。

Get-DistributionGroup Head-of-Ops | Select-Object Name,GroupType,ManagedBy,@{Expression={(Get-Group $_.Name).Notes};Label="Notes"}

メモがなくても同じ出力が得られます...

Name        GroupType ManagedBy Notes
----        --------- --------- -----
Head-of-Ops Universal {}

全然分からないよ :/

皆さんの中にこの問題に気付いていて、私に指摘してくれる人はいませんか?

敬具、

ケビン・ヴァン・ティール

答え1

このコマンドを -verbose パラメータ付きで実行したところ、解決に一歩近づいたと思います。ある時点でパラメータが足りないだけだと思いますが、どのパラメータが足りないのかはわかりません。コードは次のとおりです: (機密情報には * アスタリスクを付けました)

Get-DistributionGroup Head-of-Ops@h***.com -Verbose | Select-Object Name,GroupType,ManagedBy,@{Name="Notes";Expression={(Get-Group $_.Name).Notes}} -Verbose
VERBOSE: [16:04:28.885 GMT] Get-DistributionGroup : Active Directory session settings for 'Get-DistributionGroup' are: View Entire Forest: 'False', Default Scope: 'h***.de', Configuration Domain Controller: 'H***.h***.de',
Preferred Global Catalog: '***.h***.h***.de', Preferred Domain Controllers: '{ ****.h***.h***.de, H***.h***.de }'
VERBOSE: [16:04:28.916 GMT] Get-DistributionGroup : Runspace context: Executing user: h***.de/Companies/H***/D***/User/IT Service/****, Executing user organization: , Current organization: , RBAC-enabled: Enabled.
VERBOSE: [16:04:28.916 GMT] Get-DistributionGroup : Beginning processing &
VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Current ScopeSet is: { Recipient Read Scope: {{, }}, Recipient Write Scopes: {{, }}, Configuration Read Scope: {{, }}, Configuration Write Scope(s): {{, }, }, Exclusive Recipient
Scope(s): {}, Exclusive Configuration Scope(s): {} }
VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Resolved current organization: .
VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Searching objects "Head-of-Ops@h***.com" of type "ADGroup" under the root "$null".
VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Previous operation run on domain controller 'H***.h***.de'.
VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Previous operation run on domain controller 'H***.h***.de'.
VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Preparing to output objects. The maximum size of the result set is "1000".

VERBOSE: [16:04:28.947 GMT] Get-DistributionGroup : Ending processing &
Name        GroupType ManagedBy Notes
----        --------- --------- -----
Head-of-Ops Universal {}

次の行は、問題が埋もれていると思われる行です。

VERBOSE: [16:04:28.932 GMT] Get-DistributionGroup : Searching objects "Head-of-Ops@h***.com" of type "ADGroup" under the root "$null".

何が欠けているのか、またその理由は何かご存知の方はいらっしゃいますか?

関連情報