SendOnBehalfTo - Only show the display name in results

I'm pretty sure this one should be easy but I'll be damned if I can find anything on the internet for it.

If I run :

Get-Mailbox graham.jordan | ft DisplayName, GrantSendOnBehalfto

I get :

DisplayName                                                    GrantSendOnBehalfTo                                          
-----------                                                    -------------------                                          
Graham.Jordan                                            {ad.example.local/OU1/example/Graham Jordan}

Is there anyway of removing the DN so I only have the name? 

Thanks for your time. :)

May 27th, 2015 6:29am

Hello,

As an alternative, execute the following cmdlet to save the result as a csv file and process the filtering there:

Get-Mailbox graham.jordan | Select-Object *grantsendonbehalfto | Export-Csv c:\123.csv

Free Windows Admin Tool Kit Click here and download it now
May 27th, 2015 11:22am

Hiya,

Thanks for your response.

Sadly not. This is part of a larger "grant SendOnBehalfTo" script we're handing over to the Service Desk. It needs to be as simple as possible, just on screen display. The rest of it (adding users) works fine, I just want it to display the results in an easy to understand way.

But again, thanks for the input.

May 27th, 2015 11:47am

Hello

tip:

Get-Mailbox administrator |Select-Object -property @{label="GrantSendOnBehalfto"; expression={$_.GrantSendOnBehalfto |get-mailbox |select display

Free Windows Admin Tool Kit Click here and download it now
May 27th, 2015 1:22pm

Hello Sneff,

Thanks for your response. I'm pleased to say we're making progress but it's not quite there yet. 

This is what I get when ran against a box with several users who have SOBO access.

$usermailbox = read-host " "

Get-Mailbox $usermailbox | Select-Object -property @{label="GrantSendOnBehalfto"; expression={$_.GrantSendOnBehalfto | get-mailbox | select displayname }}

GrantSendOnBehalfto                                                                                                                                                      
-------------------                                                                                                                                                      
{@{DisplayName=Syed Smith}, @{DisplayName=Russell Smith}, @{DisplayName=Clifford Smith}, @{DisplayName=Hasan Smith}...}

If I remove the "select displayname" from the line of code I get...

GrantSendOnBehalfto                                                                                                                                                      
-------------------                                                                                                                                                      
{Syed Smith, Russell Smith, Clifford Smith, Hasan Smith...}

which is a little better but it still cuts people off. Any ideas on how to display the results in ft? I've tried but failed miserably. 

Thanks for your kindness

May 28th, 2015 10:14am

Hello

tip:

add to end:
 |Ft -autosize | out-string -width 4096

Free Windows Admin Tool Kit Click here and download it now
May 28th, 2015 12:56pm

Hi Sneff,

Forgive me for not understanding where to put the additional information however having played around a little I've now got this:

Get-Mailbox administrator | fl -property @{label="GrantSendOnBehalfto"; expression={$_.GrantSendOnBehalfto | get-mailbox | Out-String -Width 96 }}


GrantSendOnBehalfto :
Name		          Alias                ServerName         ProhibitSendQuota
---------                ----------       -----------------
Syed smith                Ssmith               exchange4          Unlimited
Russell smith             rusmith              exchange4          Unlimited
Clifford Smith        	  CSmith               exchange3          Unlimited
Hasan Smith               HASmith              exchange2          Unlimited
McCauley Smith            MSmith               exchange4          Unlimited
Sanjay J Smith            SJSmith              exchange4          Unlimited
Ismail Smith              ISSmith              exchange1          Unlimited
Umesh Smith               USmith               exchange4          1 GB (1,073,741,824 bytes)
Paul Smith                PSmith               exchange4          1 GB (1,073,741,824 bytes)
Imi Smith                 ISmith               exchange2          293 MB (307,200,000 bytes)

In a perfect world I'd be without the ServerName or ProhibitSendQuota but this is still way better than anything I've been able to achieve so very grateful for your response and advice. 

Thank you. 

May 29th, 2015 4:17am

Hi Sneff,

Forgive me for not understanding where to put the additional information however having played around a little I've now got this:

Get-Mailbox administrator | fl -property @{label="GrantSendOnBehalfto"; expression={$_.GrantSendOnBehalfto | get-mailbox | Out-String -Width 96 }}


GrantSendOnBehalfto :
Name		          Alias                ServerName         ProhibitSendQuota
---------                ----------       -----------------
Syed smith                Ssmith               exchange4          Unlimited
Russell smith             rusmith              exchange4          Unlimited
Clifford Smith        	  CSmith               exchange3          Unlimited
Hasan Smith               HASmith              exchange2          Unlimited
McCauley Smith            MSmith               exchange4          Unlimited
Sanjay J Smith            SJSmith              exchange4          Unlimited
Ismail Smith              ISSmith              exchange1          Unlimited
Umesh Smith               USmith               exchange4          1 GB (1,073,741,824 bytes)
Paul Smith                PSmith               exchange4          1 GB (1,073,741,824 bytes)
Imi Smith                 ISmith               exchange2          293 MB (307,200,000 bytes)

In a perfect world I'd be without the ServerName or ProhibitSendQuota but this is still way better than anything I've been able to achieve so very grateful for your response and advice. 

Thank you. 

Free Windows Admin Tool Kit Click here and download it now
May 29th, 2015 8:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics