Find empty groups in Active Directory using PowerShell script

Posted: July 23, 2013 in Scripts
Tags:

You can find the empty groups from your domain using below powershell command.

Import-Module activedirectory
Get-ADGroup -Filter * -Properties Members | where {-not $_.members} | select Name | Export-Csv D:\emprtygroups.csv –NoTypeInformation

To find empty groups from any specific OU present in other domain:-

Import-Module activedirectory
Get-ADGroup -Filter * -Properties Members -searchbase “OU fqdn” –server Domain.com:3268  | where {-not $_.members} | select Name | Export-Csv D:\emprtygroups.csv –NoTypeInformation

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s