[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

How to show and expand recipient column in the powershell script ?

Hi People,

How can I show and expand the recipient column from the below powershell script result ?

Get-TransportServer | Get-Queue | Get-Message| Select Identity, Subject, FromAddress, Recipients | Sort-Object FromAddress | ft -AutoSize

Open in new window


it is always empty be it one or more than one recipients listed.

Thanks.
0
Senior IT System Engineer
Asked:
Senior IT System Engineer
  • 3
  • 2
1 Solution
 
QlemoC++ DeveloperCommented:
You'll have to convert the array into a string:
Get-TransportServer | Get-Queue | Get-Message|
   Select Identity, Subject, FromAddress,
     @{n = 'Recipients'; e={$_.Recipients -join '; '}} |
   Sort-Object FromAddress |
   ft -AutoSize

Open in new window

0
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
Thanks QLemo,

Somehow the result is still blank ? why is that ?
I've tried to stretch the PowerGUI window into both monitor but I can't see the recipients result ?
0
 
QlemoC++ DeveloperCommented:
I can't test ATM. A blank property usually means a typo (the property does not exist), so the first thing to check.
0
 
QlemoC++ DeveloperCommented:
Reread the get-message help, and found that you need -IncludeRecipientInfo to get values in Recipients.
Get-TransportServer | Get-Queue | Get-Message|
   Select Identity, Subject, FromAddress,
     @{n = 'Recipients'; e={($_.Recipients | select -Expand Address) -join '; '}} |
   Sort-Object FromAddress |
   ft -AutoSize

Open in new window

0
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
thanks man !
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now