akorkishko
asked on
Address lists in Exchange 2010 with multiple CustomAttributes
Exchange 2010 SP1 RU5
I am trying to make dynamic address book lists according to Custom Attributes. I have some teachers that teach at different schools and they need to be put in address books which are set up for each school. I populated extensionAtrributes in AD with school locations which a teacher belongs to according to Human Resources. Then I made an address list with Custom Attributes set to multiple locations like this:
new-AddressList -Name 'test-fremont' -RecipientContainer 'sdw.ad/SCHOOLS' -IncludedRecipients 'AllRecipients' -ConditionalCustomAttribut e2 '706' -ConditionalCustomAttribut e3 '706' -Container '\Schools' -DisplayName 'test-school'
My AD extensionAttributes:
extensionAttribute 2 = 701 ==> Custom Attribute 2
extensionAttribute 3 = 706 ==> Custom Attribute 3
My problem is that I can't use (or don't know how to) multiple CustomAttributes as an 'OR' statement. In my statement above it command tries to meet all requirements. So if I have a teacher with multiple extensionAttributes in AD, I can't just pick one Custom Attribute. I was hoping to use an -OR statement in the new-AddressList command to populate those lists. Is there a way to use the -OR or is there a better way to create address lists and look at different Custom Attributes for location?
Thanks, Alex
I am trying to make dynamic address book lists according to Custom Attributes. I have some teachers that teach at different schools and they need to be put in address books which are set up for each school. I populated extensionAtrributes in AD with school locations which a teacher belongs to according to Human Resources. Then I made an address list with Custom Attributes set to multiple locations like this:
new-AddressList -Name 'test-fremont' -RecipientContainer 'sdw.ad/SCHOOLS' -IncludedRecipients 'AllRecipients' -ConditionalCustomAttribut
My AD extensionAttributes:
extensionAttribute 2 = 701 ==> Custom Attribute 2
extensionAttribute 3 = 706 ==> Custom Attribute 3
My problem is that I can't use (or don't know how to) multiple CustomAttributes as an 'OR' statement. In my statement above it command tries to meet all requirements. So if I have a teacher with multiple extensionAttributes in AD, I can't just pick one Custom Attribute. I was hoping to use an -OR statement in the new-AddressList command to populate those lists. Is there a way to use the -OR or is there a better way to create address lists and look at different Custom Attributes for location?
Thanks, Alex
Try it this way:
Replace: -ConditionalCustomAttribut e2 '706' -ConditionalCustomAttribut e3 '706'
With: -RecipientFilter {(ExtensionAttribute2 -eq "701") -OR (ExtensionAttribute3 -eq "706")}
Have not tested. But I think that should do it.
Replace: -ConditionalCustomAttribut
With: -RecipientFilter {(ExtensionAttribute2 -eq "701") -OR (ExtensionAttribute3 -eq "706")}
Have not tested. But I think that should do it.
ASKER
Thanks for replies guys.
FDISKWizard, I have tried your recommendation and this is what I got:
[PS] C:\Windows\system32>new-Ad dressList -Name 'test-1' -RecipientContainer 'wsd.ad/SCHOOLS' -IncludedRecipients 'AllRec
ipients' -RecipientFilter {(ExtensionAttribute2 -eq "701") -OR (ExtensionAttribute3 -eq "706")} -Container '\Schools' -D
isplayName 'test-school'
Parameter set cannot be resolved using the specified named parameters.
+ CategoryInfo : InvalidArgument: (:) [New-AddressList], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,New- AddressLis t
Any clues?
FDISKWizard, I have tried your recommendation and this is what I got:
[PS] C:\Windows\system32>new-Ad
ipients' -RecipientFilter {(ExtensionAttribute2 -eq "701") -OR (ExtensionAttribute3 -eq "706")} -Container '\Schools' -D
isplayName 'test-school'
Parameter set cannot be resolved using the specified named parameters.
+ CategoryInfo : InvalidArgument: (:) [New-AddressList], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,New-
Any clues?
try this
-RecipientFilter {(RecipientType -eq 'UserMailbox') -and (ExtensionAttribute2 -eq "701") -or (ExtensionAttribute3 -eq "706")}
-RecipientFilter {(RecipientType -eq 'UserMailbox') -and (ExtensionAttribute2 -eq "701") -or (ExtensionAttribute3 -eq "706")}
ASKER
Same error:
[PS] C:\Windows\system32>New-Ad dressList -Name 'test-1' -RecipientContainer 'wsd.ad\Schools' -IncludedRecipients 'AllRecipients' -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (ExtensionAttribute -eq "701") -or (ExtensionAttribute -eq "706")} -Container '\Schools' -DisplayName 'test-1'
Parameter set cannot be resolved using the specified named parameters.
+ CategoryInfo : InvalidArgument: (:) [New-AddressList], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,New- AddressLis t
Thanks again for the help.
[PS] C:\Windows\system32>New-Ad
Parameter set cannot be resolved using the specified named parameters.
+ CategoryInfo : InvalidArgument: (:) [New-AddressList], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,New-
Thanks again for the help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys, figured it out. You had me on the right path. I had to replace extensionAttribute with CustomAttribute, I guess Exchange doesn't see 'extensionAttribute' from AD.
My final command looks like this, in case someone else runs into this:
[PS] C:\Windows\system32>New-Ad dressList -Name 'test-1' -RecipientContainer 'wsd.ad' -RecipientFilter {(CustomAttribute2 -eq "701") -or (CustomAttribute3 -eq "706")} -Container '\Schools' -DisplayName 'test-1'
Since both of you helped me, can I give points to both of you?
My final command looks like this, in case someone else runs into this:
[PS] C:\Windows\system32>New-Ad
Since both of you helped me, can I give points to both of you?
yes the points can be split
ASKER
I added my own solution for others to see the correct syntax
•Powershell uses "-and", "-or", and "-not" (yes, with leading hyphen)
http://blogs.technet.com/b/exchange/archive/2007/01/10/3397707.aspx
Some good examples of -or
http://technet.microsoft.com/en-us/library/cc164375.aspx