[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1737
  • Last Modified:

Get-DistributionGroup all groups without members

Whats the cmdlet to search then export to csv for all Distribution Lists that don't have any members in it?

Get-DistributionGroup .....................................................................

Thanks in advance.
0
GCTTechs
Asked:
GCTTechs
2 Solutions
 
Haresh NikumbhSr. Tech leadCommented:
It finds all empty groups and exports the Group Name, Group Type, and location in the directory for you all in a CSV file.

Save to .ps1 and run with .\filename.ps1.

$groups = Get-DistributionGroup
$amount = @()
foreach ($a in $groups)
{
   $groupMem = Get-DistributionGroupMember $a
   if ($groupMem.Count -eq $null) { $amount += $a }
}
Write-Output $amount | Select-Object Name,GroupType,OrganizationalUnit | Export-CSV -notypeinformation -Path C:\Empty.csv


Source:

http://forums.msexchange.org/m_1800490641/tm.htm
0

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now