ccmhia
asked on
Use ExtensionAttribute to exclude users from Dynamic Distribution group Exch. 2010
I have a dynamic distribution group that includes all Exchange email users but have a few users I don't want in the group. I want to use extensionAttribute to exclude these users. What is the powershell command I use to do this?
ASKER
I'm not wanting how to add the attribute. I need to have my DynamicDistribution group to exclude a user that has a value in their extensionattribute. The attribute is populated with "myString" any user that has that value should not receive emails that are sent to the DynamicDistribution group.
One way is to know what it has all users into a variable with the property "extensionattribute" and then do a foreach (%{}) where you will apply the logic to add/remove from the group.
$AllusersWithProperties= Get-ADUser -filter * -properties extensionattribute | select * | where{ $_.extensionattribute -eq "Something"}
$AllusersWithProperties | %{
check property value with if block and then add the logic to add or remove
}
ASKER
Well I think I'm not explaining what I want to do very well. I'll give an example. of one I have already that a vendor set up for me and now I want to do a similar thing. In Exchange I have a Dynamic Distribution Group called :All (company) Email Users". It includes every user except those users that have the word "physician" in extensionAttribute15. Any email sent to "All (company) Email Users" is delivered to everyone EXCEPT those with the word "physician" in extensionAttribute15 in Active Directory. When I look at the Recipients filter in the Dynamic Distribution List I see this:
(&(!cn=SystemMailbox{*})(& (&(&(& (mailnickname=*) (| (&(objectCategory=person)( objectClas s=user)(|( homeMDB=*) (msExchHom eServerNam e=*))) )))(objectCategory=user)(! extensionA ttribute15 =physician ))))
I want to recreate this in another Dynamic Distribution Group but want to filter out all users that have the word "Diane" in extensionAttribute1.
(&(!cn=SystemMailbox{*})(&
I want to recreate this in another Dynamic Distribution Group but want to filter out all users that have the word "Diane" in extensionAttribute1.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Thank you Thank you. Exactly what I was looking for!
Np :)
Open in new window
ToRemoveOpen in new window