John Wan
asked on
Exchange 2010 Dynamic Groups Recipient Filter format
I am trying to create a custom recipient filter to create dynamic distribution groups.
New-DynamicDistributionGro up -Name “TestGroup" -OrganizationalUnit "domain.com/Enterprise/Que ry-Based Groups" -RecipientContainer "domain.com/Staff” -RecipientFilter {(RecipientType -eq ‘UserMailbox’ -and Office -eq "Location1”) -and (-not(Department –eq ‘Contractors’))}
1. Its not clear when to use 'location1' or "location1" Appreciate any clarification on that
2. the above syntax is incorrect. I can use the above to create a group for that location, but i want to be able to exclude users with a specific department field. Its too unwieldy to include 99 of 100 departments, i prefer to just filter out the ones i dont want.
3. how to i have multiple departments excluded
Many thanks
New-DynamicDistributionGro
1. Its not clear when to use 'location1' or "location1" Appreciate any clarification on that
2. the above syntax is incorrect. I can use the above to create a group for that location, but i want to be able to exclude users with a specific department field. Its too unwieldy to include 99 of 100 departments, i prefer to just filter out the ones i dont want.
3. how to i have multiple departments excluded
Many thanks
ASKER
Thank you. But when i run it get a syntax error. Is something wrong with the way the command is structured?
please paste the error
ASKER
Invoke-Command : Cannot bind parameter 'RecipientFilter' to the target. Exception setting "RecipientFilter": "Invalid filter syntax. For a description of the filter parameter syntax see the command help.
"(RecipientType -eq ‘UserMailbox’ -and Office -eq “TestGroup”) -and (-not(Department –eq ‘Contractors’ -or Department –eq
‘Contractors1’))" at position 20."
At C:\Users\auser\AppData\Roa ming\Micro soft\Excha nge\Remote PowerShell \exchange- server.dom ain.com\ex change-ser ver
.domain.com.psm1:25743 char:29
+ $scriptCmd = { & <<<< $script:InvokeCommand `
+ CategoryInfo : WriteError: (:) [New-DynamicDistributionGr oup], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed,Mic rosoft.Exc hange.Mana gement.Rec ipientTask s.NewDynam icDistribu tionGroup
"(RecipientType -eq ‘UserMailbox’ -and Office -eq “TestGroup”) -and (-not(Department –eq ‘Contractors’ -or Department –eq
‘Contractors1’))" at position 20."
At C:\Users\auser\AppData\Roa
.domain.com.psm1:25743 char:29
+ $scriptCmd = { & <<<< $script:InvokeCommand `
+ CategoryInfo : WriteError: (:) [New-DynamicDistributionGr
+ FullyQualifiedErrorId : ParameterBindingFailed,Mic
ASKER
thanks, any other thoughts on why this command doesn't work?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much - apologies for late response, but this was really appreciated.
Cheers
Cheers
You are creating DDL for those are based on location1 and recipient type is user mailbox, if you don't want them to filter location wise then remove -and Office -eq "Location1” syntax. To filter multiple departments use or condition as below mentioned.
New-DynamicDistributionGro