header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

We have a new sponsor!  Introducting Pragma Systems.  See the home page for details.

parsing emailaddresses field
Last Post 09 Jul 2010 06:48 PM 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 03:06 PM  
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.shawUser is Offline
Site Moderator
Advanced Member
Advanced Member
Posts:670
Avatar

--
09 Jul 2010 03:14 PM  
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 03:26 PM  
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:72
Avatar

--
09 Jul 2010 03:42 PM  
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.shawUser is Offline
Site Moderator
Advanced Member
Advanced Member
Posts:670
Avatar

--
09 Jul 2010 03:43 PM  
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:72
Avatar

--
09 Jul 2010 03:44 PM  
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:72
Avatar

--
09 Jul 2010 03:48 PM  
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 06:48 PM  
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.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 footer
footer