Quantcast
Viewing all articles
Browse latest Browse all 8719

Powershell question re: dynamic distribution groups. I need help restricting results.

I'm trying to do an export of a Dynamic Distribution Group on my exchange server.  My server is owned by our company's parent company, and I keep getting users outside our organization (it is not limiting to the list I request).  I've looked at tons of tutorials online and they all say the same thing to get this task accomplished, but it does not seem to work in my situation.  Here's what I'm using, pared down to the basics (just 2 commands).  I can fit this into my larger script if I get it to work.

$AllEmployeesGroup = Get-DynamicDistributionGroup -Identity 'MYCORP - All Employees'
Get-Recipient -RecipientPreviewFilter $AllEmployeesGroup.RecipientFilter

The Dynamic Distribution group 'MYCORP - All Employees' is located in the OU (root)/(grandparent company)/(parent company)/MYCORP/Groups, but when I run the commands above I get stuff from other OUs, and stuff way outside of anything on that specific list.  I tried running a Set-AdServerSettings -RecipientViewRoot, but I get a powershell error saying it isn't a valid cmdlet, function, script (docs say 'This cmdlet is available only in on-premises Exchange Server 2013'), so I guess i'm out of luck there, but I don't think that would solve my issue anyway, as I think I'm getting entries from other groups in my company too, like it isn't applying the recipient filter at all.

If I just put in $AllEmployeesGroup after running the commands above, I get:
Name                                                  ManagedBy
MYCORP - All Employees                       (path to managed by record)...

...so the object seems to be in there correctly.  If I try $AllEmployeesGroup.RecipientFilter instead, I can see the recipient filter, which looks like this:

 ((Alias -ne $null) -and (-not(Name -like 'SystemMailbox(*')) -and (-not(Name -like 'CAS_{*')))

(above is OPATH, LDAP is similarly wide).  This looks to me like that should pull everyone (which is what it is doing).  This particular list is confined to a specific OU (that's how it is defined).  Is this a problem with the list? should it have settings in the OPATH/LDAP recipient filters specifying limits on the scope, not just in the RecipientContainer (which looks correct, listing the folder/OU this list pulls from)?

I didn't make this list originally, so I'm not sure the method used.  If the RecipientFilter should not contain scope information, is there a way to pull a full listing of this group via powershell?  Any help would be appreciated. 

 


Viewing all articles
Browse latest Browse all 8719

Trending Articles