List all disabled accounts within all groups (security and distribution) through Powershell

I'm looking for a way to list all the disabled user accounts that are currently members of the groups in our AD

We are attempting to clean up Active Directory after inheriting from a poor network admin

I located this script here:

Get-ADGroupMember -Identity "GroupName" -Recursive | %{Get-ADUser -Identity $_.distinguishedName -Properties Enabled }

But it's appears as though it only does one at a time

Are there any scripts out there that can show me the disabled users, the name of the group and also the type of group that the disabled user is a member of?

Any assistance would be greatly appreciated!

Thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

imkotteesSenior Messaging EngineerCommented:
this should work for you.

import-module activedirectory
Get-ADUser -Filter {Enabled -eq $false} -Properties * | ft name, memberof

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NetGenITAuthor Commented:
Thank you imkottees

The member of field is coming up this way


Is there any way to just have this display with the just the group name?
Will SzymkowskiSenior Solution ArchitectCommented:
The script below should get the results you are looking for. Test this first.
$groups = Get-ADGroup -Filter *
ForEach ($group in $groups)
        $Members = Get-ADGroupMember -Identity $group
            ForEach ($Member in $Members) 
                    $check = Get-ADUser -Identity $Member.samaccountname

        if ($check.Enabled -eq $false)
        Write-Output "$Member.Name is disbaled and part of $group.Name"

Open in new window

NetGenITAuthor Commented:
Thank you for the response Will Szymkowski, but it gave out a number of errors about not being able to find objects
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.