Need help completing this Powershell script with some Exchange 2010 commands.
- by Pure.Krome
Hi folks.
the following powershell script lists all the email aliases I have for a single mailbox.
>$mbx = Get-Mailbox myuser
>$mbx.EmailAddresses
and that lists all the addresses. eg.
SmtpAddress : [email protected]
AddressString : [email protected]
ProxyAddressString : smtp:[email protected]
Prefix : SMTP
IsPrimaryAddress : False
PrefixString : smtp
SmtpAddress : [email protected]
AddressString : [email protected]
ProxyAddressString : smtp:[email protected]
Prefix : SMTP
IsPrimaryAddress : False
PrefixString : smtp
SmtpAddress : [email protected]
AddressString : [email protected]
ProxyAddressString : SMTP:[email protected]
Prefix : SMTP
IsPrimaryAddress : True
PrefixString : SMTP
Now to add a new email address, I do the following poweshell command :-
$mbx.EmailAddresses += "myEmailAddress.com"
$mbx | Set-Mailbox
So i'm not sure how i can use the foreach to remove each address?
I tried:-
@mbx.EmailAddresses | foreach { $mbx.EmailAddresses -= $._SmtpAddress }
and that failed miserably. That's my first attempt of PS script, ever :P
Can anyone help?