Jump to content

Recommended Posts

Posted (edited)

Hi,

 

I was wondering if someone can help with GAL filters please? I would like a GAL that only displays:

 

Groups where the email address domain is example.com

Users with the company field set to "school1".

Users with the company field set to "school2" and the department is set to "Staff"

 

or

 

Groups where the company attribute is set to "School1"

Users with the company field set to "school1".

Users with the company field set to "school2" and the department is set to "Staff"

 

I can't get it setup quite right.

 

Thanks very much

Edited by FN-GM
Posted

I use the following, I use group membership only as I find it more reliable as we use them for so many other things.

 

I'm not sure what the commands for getting a property are but this works and it shouldn't be too much of a stretch to get there from here.

 

I can look the other commands up if yourself struggle.

 

\\Set $dn to the Group you want to use for membership to GAL

$dn = (Get-DistributionGroup Staff).distinguishedName

 

\\Create a new User Address List

New-AddressList -Name "Staff.Mailboxes" -RecipientFilter "RecipientType -eq 'UserMailbox' -and memberOfGroup -eq '$dn' " -DisplayName "Staff Address List"

 

\\Create a new Global Address List

New-GlobalAddressList -Name "Staff.GAL" -RecipientFilter "MemberOfGroup -eq '$dn' "

 

\\Create a new Offline Address List

New-OfflineAddressBook -Name "Staff.OAB" -AddressList "Staff.GAL"

  • Thanks 1
Posted

I have been having a think of this. It should be quite simple. I am going to test this. I just have the make sure the company attribute for the group is populated

 

New-GlobalAddressList -name "Staff GAL" -RecipientFilter ((Company -eq 'School1) -or ((Company -eq 'School2') -and (Department -eq 'Staff')))

Posted (edited)
New-GlobalAddressList -Name "MCA_GAL" -IncludedRecipients MailboxUsers -ConditionalCompany [sCHOOL NAME]

From another post on EduGeek.

 

The following parameters are considered precanned filters:

 

  • IncludedRecipients
  • ConditionalCompany
  • ConditionalDepartment
  • ConditionalStateOrProvince
  • ConditionalCustomAttribute1–15.

 

So you should be able to build multiple commands from that although I am sure you could condense them so you can create the group where you want to search for school & staff.

Edited by Edu-IT
  • Thanks 1
Posted (edited)
I take it you have multiple schools in one ad forest looking at the way you want the groups?

 

Yep, we are a multi Academy Trust. And we all share 1 IT service.

 

So just to get my head around this i should be able to use the company attribute for groups?

Edited by FN-GM
Posted (edited)
Yep, we are a multi Academy Trust. And we all share 1 IT service.

 

So just to get my head around this i should be able to use the company attribute for groups?

 

You can use the company attribute on any object in active directory for a filter. We have used similar attributes to determine which address list people show up in. There are a couple of ways to do it, the recipient filter that you posted is one way:

 

New-GlobalAddressList -name "New GAL" -RecipientFilter { (Company -eq 'School1') }

New-GlobalAddressList -name "New GAL2" -RecipientFilter { (Company -eq 'School1') -and (Department -eq 'Staff') }

 

You don't necessarily need to filter the RecipientType as in your example, though it depends what you actually want to show in the GAL.

 

And as Edu-IT suggested, there are pre determined conditional filters you can use rather than using the full blown RecipientFilter. There are also other attributes you can use, CustomAttributes can be extremely useful in this circumstance if you want to take a more granular approach.

 

Also, slightly unrelated however if you want to filter RecipientTypes and use Office 365 Groups, you need to include this somewhere in your filter:

 

(RecipientTypeDetails -eq 'GroupMailbox')

 

Edit: A further option you were looking for was email address domain, depending on how your emails/accounts are configured you could filter by upn:

 

New-GlobalAddressList -name "New GAL" -RecipientFilter { (UserPrincipleName -eq 'schooldomain.co.uk') }

 

Alternatively you should be able to use proxyAddresses like this, however this isn't something I have tested:

 

New-GlobalAddressList -name "New GAL" -RecipientFilter { (proxyAddresses -like '*@schooldomain.co.uk') }

 

My advice would be to make a new addresslist with a recipient filter and play around with it rather than making a GAL initially. Sorry this post has become so rambling!

 

Here is a list of attributes you can filter by: https://technet.microsoft.com/en-us/library/bb738157%28v=exchg.150%29.aspx

Edited by JRowley

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...