none
Getting SIP Address RRS feed

  • Question

  • Hello Script Gurus,

    I'm trying to get all users DisplayName, UserPrincipalName, PrimarySMTPAddress and the SIP Address in O365 powershell but unsuccessful at the script.

    This is the command I have and I'm able to get the DisplayName, UPN, and Primary SMTP Address, but the SIP Address is empty/ null.  The data is definitely there when I do a get-mailbox xxx.xxx@yyy.com on my account and I see the PrefixString on one of my Email Addresses as SIP:xxx.xxx@yyy.com.  Any pointer you can give is much appreciated.

    Get-Mailbox -resultsize unlimited | Select-Object DisplayName, UserPrincipalName, PrimarySMTPAddress, @{Name="EmailAddresses";Expression={$_.EmailAddresses | Where {$_.PrefixString -eq "sip"}}}

    DisplayName          UserPrincipalName      PrimarySmtpAddress          EmailAddresses                                               
    -----------               ------------                 -------------                        --------------                                      
    XXX, XXX               xxx.xxx@yyy.com       xxx.xxx@yyy.com                                                                                       
    XXX, XXX               xxx.xxx@yyy.com       xxx.xxx@yyy.com                                                                                      
    XXX, XXX               xxx.xxx@yyy.com       xxx.xxx@yyy.com                                                                                   

    Thanks in advance.


    Tuesday, February 27, 2018 12:22 AM

Answers

  • This works fine for me:

     Get-Mailbox  | select Name,@{n='SIPADDRESS';e={$_.EmailAddresses | Where {$_ -match 'SIP:'}}}


    \_(ツ)_/


    • Edited by jrv Tuesday, February 27, 2018 1:15 AM
    • Marked as answer by Please_HelpMe Tuesday, February 27, 2018 1:34 AM
    Tuesday, February 27, 2018 1:14 AM

All replies

  • InO365 it is "EmailAddresses" and there is no "PrefixString".  There are only full addresses in an array.

    Get-Mailbox userid | select -expand EmailAddresses | Where{$_ -match 'SIP:'}


    \_(ツ)_/

    Tuesday, February 27, 2018 12:37 AM
  • Thanks JRV, 

    Good to know that PrefixString is not in O365, your command work great for a single property, but it doesn't seem like it work on array of strings or at least I didn't know how.

    If I ran what you suggested, it give me the correct output.

    PS C:\Users\> Get-Mailbox xxx | select -ExpandProperty EmailAddresses | where{$_ -match 'SIP:'}
    SIP:xxx.xxx@yyy.com

    If I ran below,

    Get-Mailbox xxx | Select DisplayName, UserPrincipalName, PrimarySMTPAddress, EmailAddresses, @{Name='EmailAddresses';Expression={$_.EmailAddresses | Where {$_ -match 'SIP:'}}}

    DisplayName       UserPrincipalName             PrimarySmtpAddress                 EmailAddresses                                      

    -----------      -----------------       -----------------               --------------                                      
    xxx, xxx        xxx.xxx@yyy.com    xxx.xxx@yyy.com         {smtp:xxx@aaa.com,smtp:xxx.xxx@bbb.com....

    Is there a way to make this into one array of string so I can export them out into a csv file?

    Thanks again.


    Tuesday, February 27, 2018 1:07 AM
  • No.  My command works perfectly on an array of addresses.

    \_(ツ)_/

    Tuesday, February 27, 2018 1:09 AM
  • Is there a way to just show the SIP Address under EmailAddresses instead of showing every single email addresses?

    Desire Output:

    DisplayName       UserPrincipalName             PrimarySmtpAddress                 EmailAddresses                                      

    -----------      -----------------       -----------------               --------------                                      
    xxx, xxx        xxx.xxx@yyy.com    xxx.xxx@yyy.com         SIP:xxx.xxx@yyy.com

    Current Output:

    DisplayName       UserPrincipalName             PrimarySmtpAddress                 EmailAddresses                                      

    -----------      -----------------       -----------------               --------------                                      
    xxx, xxx        xxx.xxx@yyy.com    xxx.xxx@yyy.com         {smtp:xxx@aaa.com,smtp:xxx.xxx@bbb.com....

    Thanks.

    Tuesday, February 27, 2018 1:13 AM
  • This works fine for me:

     Get-Mailbox  | select Name,@{n='SIPADDRESS';e={$_.EmailAddresses | Where {$_ -match 'SIP:'}}}


    \_(ツ)_/


    • Edited by jrv Tuesday, February 27, 2018 1:15 AM
    • Marked as answer by Please_HelpMe Tuesday, February 27, 2018 1:34 AM
    Tuesday, February 27, 2018 1:14 AM
  • WOW...YOU'RE AWESOME!  THANK YOU VERY MUCH!!!  
    Tuesday, February 27, 2018 1:34 AM