function Add-SMTPAlias{
<# Add-SMTPAlias
.SYNOPSIS
Adds smtp alias to a given mailbox
.DESCRIPTION
.PARAMETER
alias
Users
Alias
.PARAMETER
newsmtpaddress
desired email alias
.EXAMPLE
Add-IPToSMTPRelay
-alias someuser -newsmtpaddress someusersotheremail@someserver.com
#>
[CmdletBinding()] param ( [Parameter(mandatory=$true,ValueFromPipeline=$true)] $alias, [Parameter(mandatory=$true,ValueFromPipeline=$true)] [mailaddress]$newsmtpaddress ) process{ $emailaddresses = (get-mailbox $alias).emailaddresses $emailaddresses += $newsmtpaddress.ToString() try{ Set-Mailbox $alias -EmailAddresses $emailaddresses -ErrorAction stop } catch{ write-warning ("Problem setting email address " + $_) } } } |
5 minutes or 5 seconds, the choice is yours GUI fans. Maybe it's time to give in to the power of the shell?