DL - Exch 2007
Hello, I need to add users Mailboxes AND Mails Contact who belongs to the Madrid site to an existing Distribution list. Does any shell command could do that job?? Thanks all in advance
October 26th, 2009 12:53pm
How do you differntiate the users and contcatsfrom Madrid site.so based on that try creating filters andcreatethe DLbased on the filter.Here is the command to create a DL from Shell.New-DistributionGroup -Name "Madrid" -OrganizationalUnit "testdomain.local/Madrid" -SamAccountName "Madrid" -Type "Distribution"Raj
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2009 1:08pm
From the console I can sort the users by country (madrid). I need to add those users (Contact + Mailboxes) from Madrid to the Distribution list "SPAIN". Does the command you gave me will work then? If u need further info please do not hesitate to ask me. Thanks, Graig
October 26th, 2009 3:43pm
You need to use the Add-DistributionGroupMember cmd, http://technet.microsoft.com/en-us/library/bb124340.aspxThanksWillWill Shepherd - MCSE/MCITP/MCTS (Windows 2008,Exchange 2007,OCS 2007)
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2009 4:12pm
Thank you but it does not tell me how to add users who belong to the Madrid (City: Madrid) I think that the beginning of that command will do the job: Add-DistributionGroupMember -Identity "SPAIN" But I would need help from you to define the member option. I need to add users who belong to the Madrid city. Thanks again for ur time and help. Graig
October 26th, 2009 4:24pm
You will have to do a little work to get to work for you environment but you can do something like these commands.Get-Mailbox -OrganizationalUnit "yourdomain.local/OU" | Add-DistributionGroupMember -Identiy "SPAIN"Get-MailContact -OrganizationalUnit "yourdomain.local/OU" | Add-DistributionGroupMember -Identiy "SPAIN"ThanksWillWill Shepherd - MCSE/MCITP/MCTS (Windows 2008,Exchange 2007,OCS 2007)
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2009 4:46pm
For adding mailboxes who have 'madrid' in 'City' attribute, you can use this command
get-user |where {$_.City -eq 'madrid'}|foreach{ Add-DistributionGroupMember 'SPAIN' -Member $_.Identity}
You can replace $_.City with $_.ContryOrRegion if you want to use CountryOrRegion attribute of the Exchange mailbox user.
Similary you can add MailContacts or MailUsers to distributiongroup by first getting them from exchange using Get-MailContact or Get-MailUser command.
Regards,Laeeq Qazi|Snr Software Engineer(Exchange + Sharepoint + BES + DynamicsCRM)
www.hostingcontroller.com
October 26th, 2009 5:06pm
Thanks Laeeq Qazi !! AMAZING :-D
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2009 6:20pm
You are Welcome Graig.
Regards,
Laeeq Qazi|Snr Software Engineer(Exchange + Sharepoint + BES + DynamicsCRM)
www.hostingcontroller.com
October 26th, 2009 7:59pm