header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Adding a second smtp address for a user
Last Post 07 Sep 2011 12:11 PM by Ekasare. 38 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 2 of 2 << < 12
Author Messages
kepaUser is Offline
New Member
New Member
Posts:7
Avatar

--
02 Dec 2009 01:37 AM
Thanks!!

One more question. The secondary email must be in form: firstname.lastname@domain.com. How to do this?
Shay LevyUser is Offline
PowerShell MVP, Admin
Veteran Member
Veteran Member
Posts:1362
Avatar

--
02 Dec 2009 01:57 AM
Get-Mailbox -ResultSize Unlimited -Filter {CustomAttribute1 -eq "value"} | foreach {
$user = get-user $_
$email = "{0}.{1}@domain.com" -f $user.firstName,$user.lastName
$_.EmailAddresses+= $email
$_
} | Set-Mailbox

Shay Levy
Windows PowerShell MVP
http://PowerShay.com
PowerShell Community Toolbar
Twitter: @ShayLevy
kepaUser is Offline
New Member
New Member
Posts:7
Avatar

--
02 Dec 2009 02:19 AM
Posted By Shay on 02 Dec 2009 02:57 AM
Get-Mailbox -ResultSize Unlimited -Filter {CustomAttribute1 -eq "value"} | foreach {
$user = get-user $_
$email = "{0}.{1}@domain.com" -f $user.firstName,$user.lastName
$_.EmailAddresses+= $email
$_
} | Set-Mailbox

Many thanks to you! That works just as i wanted! Need to learn PowerShell too.

kepaUser is Offline
New Member
New Member
Posts:7
Avatar

--
19 Dec 2009 02:11 AM

That code worked fine but when users name contains scandinavian letter (Ä, Ö, Å) then it will fail. How it it possible to replace Ä and Å with A and Ö with O?



mstidhamUser is Offline
New Member
New Member
Posts:1
Avatar

--
23 Feb 2010 02:13 PM
I am trying to do something similar, but many of my users' email addresses are not our standard nickname@domain.com. How can I add a new address that matches the users current primary smtp with a diffferent email domain. So that user jdoe@domain.com gets jdoe@newdomain.com and janed@domain.com gets janed@newdomain.com?
JEnfingerUser is Offline
New Member
New Member
Posts:2
Avatar

--
10 Feb 2011 12:18 PM
I have a similar issue as well, however, we have a large number of exchange servers on our domain, and I wish to add an smtp name to only the users on one of them (the admins of the others would NOT be happy if I messed with theirs).

mine would be roughly (I think, I NO KNOW CODE)

[PS] C:\>Get-Mailbox -Filter { CustomAttribute5 -eq "sub.domain"} | foreach {
$user = (Get-user $_.Domain).Domain
$email1= "$user@Sub.Domain.com"
$_.emailAddresses += ($email1)
Set-Mailbox $_ -emailAddresses $_.emailAddresses

Am I parsing that correctly?
       We just did an exchange server migration under the direction of a Higher Organziation, and they changed everyone's Primary SMTP to A.Domain.com, with B.Domain.com and Domain.com as secondary SMTPs; however, the Primary SMTP of many of our users (several hundred) was Sub.Domain.com prior to the migration, which is not in the smtp anywhere. I need to add Sub.Domain.com as a secondary smtp to all the users, so that they recieve any mail sent to them under the old addresses.
       Add to this that we have a huge domain subdivided into massive OUs as opposed to a tree as most sensible Admins would do, and my needing to do this only to my small part of it (One of 9 Exchange servers on the domain) and I'm having trouble.
       I have very little experiance scripting and have never used the PowerShell before so I am understandably nervous.
       Thanks in advance :)
JEnfingerUser is Offline
New Member
New Member
Posts:2
Avatar

--
10 Feb 2011 12:32 PM
Crap: I did not realize this Google-found thread was not the one on the front page.
I must apologise for thread resurrection.
Now, should I wait for a response in the zombie thread, or repost in the new smtp thread. . .
grrr.
btgrantUser is Offline
New Member
New Member
Posts:1
Avatar

--
03 Jun 2011 03:09 AM
$SecPass = convertto-securestring -asplaintext -string "password" -force

   
$PSCredential = new-object System.Management.Automation.PSCredential -argumentlist "user@something.dk",$SecPass

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $PSCredential -Authentication Basic -AllowRedirection
Set-ExecutionPolicy RemoteSigned
 Import-PSSession $Session

$users = Get-Mailbox
foreach ($a in $users) {$a.emailaddresses.Add("$($a.alias)@alias.something.dk")}
$users | %{Set-Mailbox $_.Identity -EmailAddresses $_.EmailAddresses}


I have made something very similiar to the above and it works fine.
But I am unsure of how I should validate it agains if the mailbox already has that alias
Because there is a tendency for it to create additional aliases each time I run the script.

Example: In Live Edu there exists main ID user@something.dk
Aliases:
user@alias.something.dk
user@alias1.something.dk


any suggestions?
EkasareUser is Offline
New Member
New Member
Posts:1
Avatar

--
07 Sep 2011 12:11 PM
I have two email policies. one is the default policy and the other is for second email address. Users with second email address are signed a custom attribute 10. But some users with the second email were not signed this custom attribute because the second email address was added manually. Can I get a script which will let me see all the users with second email but do not have the custom attribute 10 signed. The second email domain is say testonline.com and the custom attribute is testonline.
Thanks
You are not authorized to post a reply.
Page 2 of 2 << < 12


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