header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
parsing emailaddresses field
Last Post 09 Jul 2010 10:48 AM by kuliksco. 7 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
kulikscoUser is Offline
New Member
New Member
Posts:7
Avatar

--
09 Jul 2010 07:06 AM
    I'm running this command:

    Get-mailcontact -identity "wendy.anderson" | fl name, emailaddresses, legacyexchangeDN

    to get this output:

    Name : Anderson, Wendy
    EmailAddresses : {smtp:Wendy.Anderson@company.com, SMTP:WAnderso@scompany.com, x500:/o=EMAIL/ou=NA-DTW/cn=Recipients/cn=andersw, X500:/o=SPPT/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Anderson?Wendy}
    LegacyExchangeDN : /o=SNA/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Anderson, Wendy

    I'm wondering what the best way to parse out the last SPPT x500 address in emailaddresses and the legacy address. basically, i would want the output to be:

    /o=SPPT/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Anderson?Wendy

    /o=SNA/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Anderson, Wendy thanks
    Marco Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1641
    Avatar

    --
    09 Jul 2010 07:14 AM
    It's a bit difficult to read what you have being it has been all stuck together as one line. One tip though, you need to do any changes to your objects usually *before* calling fl (Format-List).

    Can you try posting what you want again?
    Marco

    *Microsoft MVP - Windows PowerShell
    https://mvp.support.microsoft.com/profile/Marco.Shaw
    *Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
    *Blog - http://marcoshaw.blogspot.com
    kulikscoUser is Offline
    New Member
    New Member
    Posts:7
    Avatar

    --
    09 Jul 2010 07:26 AM
    sorry i fixed up the entry. For some reason it wasn't seeing my line breaks so i added in the html for them.



    hmm...if i don't call 'fl' then i don't get all the data i need. Here is the output without format list:



    [PS] D:\scripts\batch_files>Get-mailcontact -identity "wendy.anderson"




    Name Alias RecipientType

    ---- ----- -------------

    Anderson, Wendy Wendy.Anderson MailContact


    Should I be formatting to a different output type to get the other information like email addresses then?
    PresenceUser is Offline
    New Member
    New Member
    Posts:87
    Avatar

    --
    09 Jul 2010 07:42 AM
    to get all info for the contact run a

    Get-mailcontact -identity "wendy.anderson" | fl

    to get specific fields...

    Get-mailcontact -identity "wendy.anderson" | select Displayname, alias, primarysmtpaddress, etc....

    when you run the | fl command, you will be able to see all the available fields..

    Thanks
    Pres
    Marco Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1641
    Avatar

    --
    09 Jul 2010 07:43 AM
    You can still use FL, you may just need to add it at the end. Before I confuse you too much, I'll stop. I don't have an Exchange VM to test this so someone else may have to step in and help you.
    Marco

    *Microsoft MVP - Windows PowerShell
    https://mvp.support.microsoft.com/profile/Marco.Shaw
    *Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
    *Blog - http://marcoshaw.blogspot.com
    PresenceUser is Offline
    New Member
    New Member
    Posts:87
    Avatar

    --
    09 Jul 2010 07:44 AM
    another option,

    if you just want to get all the info, and export it to an excel format

    get-mailcontact -identity "wendy.anderson" | export-csv C:\Info.csv
    PresenceUser is Offline
    New Member
    New Member
    Posts:87
    Avatar

    --
    09 Jul 2010 07:48 AM
    oh shoot, i'll test this quick.. i went back and re-read the top post...

    $email = get-mailcontact ...
    $email.emailaddresses | where {$_.proxyaddressstring -clike "X500*"} | select addressstring

    that should get you the primary X500 address... -like would get you all x500 addresses..

    Thanks
    Pres
    kulikscoUser is Offline
    New Member
    New Member
    Posts:7
    Avatar

    --
    09 Jul 2010 10:48 AM
    wow that was very helpful. thank you! the only thing i am wondering now is there anyway to remove the header line addressstring?

    I'm getting output like this when i have 2 users in the list:

    [PS] D:\scripts\batch_files>.\Batch_Get_x500.ps1
    Marzolino, Scott

    AddressString
    -------------
    /o=SPPT/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Marzolino?Scott
    /o=SNA/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Marzolino, Scott
    Adair, Mark
    /o=SPPT/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Mark.Adair
    /o=SNA/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Adair, Mark
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer