Mr Woober
asked on
List active users in Dynamic Distrubution list
I'm trying to get out a list over all active users that has an active account with mailbox on Exchange 2010. I managed to get a full list, but its over 100 users, so I would like to narrow down the list, to only output those active accounts with an mailbox.
I tried different scripts with Get-DistributionGroupMembe r and Get-DynamicDistributionGro up, but they only list all users, also those disabled.
Thanks in advance for any help!
I tried different scripts with Get-DistributionGroupMembe
Thanks in advance for any help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try attached script.....
Gropus.vbs
Gropus.vbs
ASKER
Thanks for the tips, this group is a dynamic group. So I probably need to remove the disabled accounts, does it remove the mailbox aswell? Because I might need to reactivate the user later.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I manage to solve it :)
Here is what I did:
$list = read-host "Name on group"
Set-DynamicDistributionGro up -Identity "$list" -RecipientFilter {
(EmailAddresses -like '*hero*') -and
(HiddenFromAddressListsEna bled -ne $true)
}
$MarketingGroup = Get-DynamicDistributionGro up "$list"
Get-Recipient -RecipientPreviewFilter $MarketingGroup.RecipientF ilter -OrganizationalUnit $MarketingGroup.Organizati onalUnit -SortBy Name >> C:\lager\activeusers.txt
Thanks for the help :)
Here is what I did:
$list = read-host "Name on group"
Set-DynamicDistributionGro
(EmailAddresses -like '*hero*') -and
(HiddenFromAddressListsEna
}
$MarketingGroup = Get-DynamicDistributionGro
Get-Recipient -RecipientPreviewFilter $MarketingGroup.RecipientF
Thanks for the help :)
ASKER
Thanks :)
OOOO "C:\lager" what kind of breweries do you work for?
ASKER
Its norwegian :)
$groups = Get-DistributionGroup -ResultSize Unlimited
$report = foreach($group in $groups){
Get-DistributionGroupMembe
?{$_.RecipientType -like '*User*' -and $_.ResourceType -eq $null} |
Get-User | ?{$_.UserAccountControl -match 'AccountDisabled'} |
Select-Object Name,RecipientType,@{n='Gr
}
$report | Export-CSV c:\disabled_group_members.
http://www.packtpub.com/article/exchange-server-2010-windows-powershell-distribution-groups