Then you will need to use a function or a filter to select the proper email addresses.
Who do you know which ones are the right ones? From: Heaton, Joseph@Wildlife [mailto:joseph.hea...@wildlife.ca.gov] Sent: Thursday, April 18, 2013 4:10 PM To: NT System Admin Issues Subject: RE: Need to create a csv through Powershell/Exchange Shell The class is: Automate Windows Server Administration with Powershell 2.0 Microsoft course #: 10325 We have a training facility here, called IS Inc. Here's what I've found so far: Get-Mailbox -ResultSize Unlimited | Select Name -expandemailaddresses | select SmtpAddress Unfortunately, that just lists everyone's e-mail addresses; all of them. We have a temp address as well as the new and old addresses. The temp address allows the old Groupwise system to forward mail over to the new Exchange mailbox. The attributes I've found that I "could" use, if I go through AD, vs. Exchange: givenName - first name mail - e-mail address (primary, but this field is not filled out for everyone. It gets filled out properly when the user is migrated to Exchange) sn - Last name proxyAddresses - gives me all e-mail addresses, but this will include addresses that I don't want, as well as those that I do. Joe Heaton Enterprise Server Support CA Department of Fish and Wildlife 1807 13th Street, Suite 201 Sacramento, CA 95811 Desk: (916) 323-1284 From: Candee [mailto:can...@gmail.com] Sent: Thursday, April 18, 2013 4:37 AM To: Heaton, Joseph@Wildlife; NT System Admin Issues Subject: Re: Need to create a csv through Powershell/Exchange Shell You can list all smtp addresses - will that work for you? I haven't tested it; but I found this. What class are you going to? I'm looking for live classroom training, but it's difficult to find. http://dxpetti.com/blog/?p=175 Get-Mailbox -Database "Mailserver\Databasename" -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name="EmailAddresses";Expression={$_EmailAddresses |Where-Object {$_.PrefixString -ceq "smtp"} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv c:\mailbox_alias.csv On Wed, Apr 17, 2013 at 6:19 PM, Heaton, Joseph@Wildlife <joseph.hea...@wildlife.ca.gov<mailto:joseph.hea...@wildlife.ca.gov>> wrote: I need the following information for all users in my organization: Primary SMTP address, First Name, Last Name, Secondary smtp address Now, I know I can get primary smtp address through Exchange Shell, but that looks like all I can get there. I see that I can use the mail field in AD, but that's a field that will be inaccurate for a lot of my folks, since not everyone has been migrated to Exchange yet, so that field is either blank, or reflects their old e-mail address. I know that I can also get givenName for first name, and sn for last name. The secondary smtp is where I am lost, as proxyAddresses lists all smtp addresses, which includes a temp address for the migration efforts, in addition to the two that I do want. Anyone have ideas? I am going to a Powershell class next month, so hopefully some of that helps me get on track with Powershell. Thanks, Joe Heaton Enterprise Server Support CA Department of Fish and Wildlife 1807 13th Street, Suite 201 Sacramento, CA 95811 Desk: (916) 323-1284<tel:%28916%29%20323-1284> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com> with the body: unsubscribe ntsysadmin ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com> with the body: unsubscribe ntsysadmin ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com> with the body: unsubscribe ntsysadmin ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin