Powershell: Exchange 2010

I have been using powershell to create AD Users and Mailboxes, similar to below:

New-MailUser -Name Bob -FirstName Bob -LastName Smith -ExternalEmailAddress
bsmith@myco.com -UserPrincipalName bob@myco.com
-OrganizationalUnit myco.com

Am I able to take it one step further and add to multiple security groups / distribution lists as well?  If so, could you provide a quick example?

Thanks
trecoolAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MaheshConnect With a Mentor ArchitectCommented:
You can just make copy of existing user having same group membership from active directory and then create mailbox either from shell or EMC
It is the easiest way if user needs to be part of bunch of groups

Mahesh
0
 
Joseph DalyCommented:
To add a user to the dirstribution group you would use a command line the one below.

Add-DistributionGroupMember -Identity "Group Name" -Member bob@myco.com
0
 
trecoolAuthor Commented:
can you append it to the original command?
0
 
Joseph DalyCommented:
You cant really append it to the first command because it is a seperate action. You need to create the user account before it can be added to any groups.
0
All Courses

From novice to tech pro — start learning today.