Link to home
Start Free TrialLog in
Avatar of Alex T
Alex TFlag for United Kingdom of Great Britain and Northern Ireland

asked on

adding an alias to a distribution group in Exchange 2010

Hi there

We have one office who has just been moved over to Office 365 for whatever reason.

The users over there require a heavy use of distribution group and due to the nature of their work, we need to often add and remove alias email addresses for the disti groups.

Now, as we all know, Office 365 management is not same as Exchange 2010 management.

The only possible way is using Powershell.

So here is my question.

1. Using Powershell, how do I add an alias to an existing distribution group?

2. When the command is run, it should add another email address as alias and not replace the existing ones as this has happned to me in the past.

Can someone please help? They are losing some important emails due to this reason.

Office 365 support is useless at this.

Exchange admins...help.!!!!
Avatar of chrismerritt
chrismerritt

I can't comment specifically on O365 as i've never used it. However you can append/remove a single value from a multivalued property (which ProxyAddresses is) by using this I believe:

http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2010/11/22/Managing-email-addresses-in-exchange-2010.aspx

I've never tried it, but it looks useful. Maybe you could add a test DL and see how it works?

Basic premise is you can quite easily add/remove addresses without having to re-add the whole lot like this:

Set-Mailbox User1 -EmailAddresses @{Add='TestUser1@domain.com’}

Create a csv file "FileName.csv"

Example:

Name
user1
user2
user3

and then run

Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "GROUP-NAME" -Member $_.Name}
rajkr2020, the question was to add email aliases not members.
Avatar of Alex T

ASKER

yes, I need this for a distribution group.

Set-Mailbox command will not work on a distribution group from what I understand.
Of course but you change the command to be the one which is relevant for your object, so you change set-mailbox for set-distributiongroup
You should be able to do it with these PowerShell commands:
Set-ExecutionPolicy RemoteSigned

Open in new window


$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session

Open in new window


Set-DistributionGroup "group1" -EmailAddresses SMTP:group1@domain.com,group1a@domain.com

Open in new window

Avatar of Alex T

ASKER

Hi Trefenwyd

I know this command already.

However, this is for adding the group for the first time.

But say I have added the group with 5 email address to start with....and then after a month I want to add the 6th one...I have to run this command with all 6 email addresses and not just the new one.
alex110109 - did you even attempt my solution?

This contains the method for adding a new email address without having to declare all the others.
Avatar of Alex T

ASKER

yes my friend I have and if I do this command with just the new address that I want to add...it removes all the other addresses.

Now, the question is..have you tried it?

The only way your solution may work is if MS change the actual commandlet in last 2 months or so...
I've used the @Add hash addition against our Exchange 2010 servers to add values to multi valued properties so yes, however as I pointed out in my original reply I can't comment specifically on O365 and what commands work against their systems. If this in not supported with them then you can't use my suggestion, simple as that.

Nowhere did you say my command didn't work though so without knowing that I could only assume it hadn't been tested, based on the information available to me at the time.

The only other thing you can do is bind to the group, retrieve it's list of email addresses, append your own to the list, then set these against it. Thus you should be able to feed a list of additions into a group without knowing what the current addresses are.

If this sounds like something you are interested in I may be able to help.
Avatar of Alex T

ASKER

Hi Chris

Yes, that sounds like a good work around.

it appears there will be multiple commands which I am happy with as long as I don't have to manually compile the list all over again.

1. assign a variable the value of the list of email addresses.

2. add the value of new email address to the variable

3. run the command to assign the group email address property with the value of updated variable...

I guess that's what the logic will be. I can work out the logic fine at times but not the commands (syntax).

So yes, if you could make up a list of command that do this then I am going to try it.

I do understand your point about O365. although since there is no documentation from MS, even I can't confirm that and we can just assume that.

ASKER CERTIFIED SOLUTION
Avatar of chrismerritt
chrismerritt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alex T

ASKER

HI

Sorry, I didn't see this update, I will give this a go and let you know.

Any update?
Avatar of Alex T

ASKER

Hi Chirs

I am talking to Office 365 support for getting the script to run and they are not as knowledgeable as I like them to be so its going through departments after departments.

But I will have to take a call on this as it has been going for a while now.