Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get-DistributionGroup all groups without members

Posted on 2013-06-25
2
Medium Priority
?
1,635 Views
Last Modified: 2013-06-25
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
Comment
Question by:GCTTechs
2 Comments
 
LVL 19

Assisted Solution

by:R--R
R--R earned 1000 total points
ID: 39275174
0
 
LVL 22

Accepted Solution

by:
Haresh Nikumbh earned 1000 total points
ID: 39275382
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question