I want to build a One-Liner to Get the Notes of a specific Distribution Group and output it alongside the Name and other information of the Distribution Group.

I've googled it and found differed sources with all the same solutions. This is one of the Solutions I found:


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

However, the Row with the Notes will always stay blank, and I don't know why:

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

When I do the following command separately:

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

... it's giving me the correct Note as Output:

Owner- Paul J.

I little later I checked if I have the correct parameters, so I tried to do it this way:

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

It worked. Output:

Owner- Paul J.

I made some changes to my command, but when I try it this way, it's still not working:

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 {}

After that, I found another Post to this Topic here: https://www.oxfordsbsguy.com/2014/04/21/exchange-powershell-how-to-enumerate-distribution-lists-managers-and-members/#comment-4452

So I made some changes to the command one more time...

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

... still, nothing has changed at all. Output:

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

I just don't get it :/

Does someone of you guys see the issue and can point me to it?

Kind regards,

Kevin van Thiel

p.S.: I've run this command with the -verbose parameter now and I think I'm now one step closer to the solution. I think at some point it's just missing a parameter, but I don't know which one.This is the Code: (I've marked sensitive information with an * asterisk)

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 {}

The following Line is the one where I think the issue is buried:

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

Anyone any idea what it's missing and why?

  • Also commented this on your SU post - Try changing "(Get-Group $_).Notes" to "(Get-Group $_.Name).Notes" in your first example. – CraftyB Mar 19 at 16:34
  • Well, I did answer to you that it didn't change anything, sadly :/ – Geco Mynx Mar 19 at 16:47

When creating a calculated property with Select-Object you need

  1. an Expression, may abbreviated to just E/e
  2. a Name OR a Label, they are synonymic and may also be reduced to the 1st letter.

From your question it's unclear if Get-DistributionGroup Head-of-Operations returns a single or mutliple objects?

Also is Head-of-Operations the same as Head-of-Ops ?

An alternative way to adding properties via Select-Object is to create a [PSCustomObject]

foreach($HeadOP in Get-DistributionGroup Head-of-Operations){
        Name      = $HeadOp.Name
        GroupType = $HeadOp.GroupType
        ManagedBy = $HeadOp.ManagedBy
        Notes     = (Get-Group $HeadOp.Name | Select-Object Notes)

Eventually you need to -ExpandProperty Notes

        Notes     = (Get-Group $HeadOp.Name | Select-Object -ExpandProperty Notes)

or shorter

        Notes     = (Get-Group $HeadOp.Name).Notes
  • 1
    The Get-DistributionGroup command gets me a single object. There is only Head-of-Ops. I would like to have it in a one-liner since I now got multiple users from Reddit and SuperUsers who are telling me, that it should work. But all of them reporting it should work are using an Exchange Online connection. So... if it's not possible to do it in one line not using the Exchange Online version, then I'll try it this way. Thank you very much for your help so far. – Geco Mynx Mar 20 at 8:51
  • Thank you again for your help. I've given up the thought doing this in just one line. Instead, I implemented different checks to make sure, I'm having an open PSSession. This is the way I've done it now: i.imgur.com/kKyCJf3.png – Geco Mynx Mar 20 at 12:10

Which version of Exchange do you use?

I tested “Get-DistributionGroup "group@domain.com" | Select-Object Name, GroupType, ManagedBy, @{Name="Notes";Expression={(Get-Group $_).Notes}} | ft -AutoSize” And it worked in both my Exchange 2010 and 2013 lab.

According your description, it is also strange that “ManagedBy” attribute is null. I’m not sure how you create this DG, but I think you may try it with a new test DG, if the script works, then I think you may review the configuration of this DG, or just rebuild it.

  • We are currently running an Exchange 2010 Server. I've tested this with another Group having a Manager and Notes as well. I've successfully got back the Name, GroupType and ManagedBy, but again no Notes... – Geco Mynx Mar 20 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.