Powershell Script to List Domain Admins with Mailboxes in Exchange 2010

Hi,

Do you know Powershell command or script I can use to list Domain Admins with Mailboxes in Exchange 2010

Best Regards,

Mark
makel2Asked:
Who is Participating?

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

x
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.

Tom CieslikIT EngineerCommented:
For example this one.
You will get Domain admin, Group name in DC and Last Logged time

Get-ADGroupMember "Domain ADmins" | Get-AdUser -Property LastLogonDate | select name,distinguishedName,LastLogonDate

Open in new window

0
makel2Author Commented:
Hi thanks for that but will the PowerShell command also show that the Group member also has a Mailbox?
0
Tom CieslikIT EngineerCommented:
You can try this one

$mailboxes = @(Get-ADGroupMember "Domain Admins" | ForEach-Object { get-mailbox $_.distinguishedname })

Open in new window


This will work if all members has mailbox
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

MaheshArchitectCommented:
Try below code from active directory PowerShell (will work on 2008 R2 / 2012 DCs)
The script will check all members of domain admins and export output only for those users who have mailbox by looking homeMDB attribute

Import-Module ActiveDirectory -ErrorAction Stop

$grpmember = Get-ADGroupMember "Domain admins"

foreach ($member in $grpmember) {

Get-ADUser -Identity $member.SamAccountName -Properties Name, homeMDB | ? {$_.homeMDB -ne $null} | Select Name, homeMDB | Export-Csv C:\mbx.csv -Append -Force -NTI

}

Open in new window

1

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
Senior IT System EngineerIT ProfessionalCommented:
Mahesh, does the Power Shell script can be executed on Exchange 2013 or 2016 as well ?
0
MaheshArchitectCommented:
The script can be executed from any server where AD PowerShell module is available
So does your exchange servers also have ad PowerShell module so you can execute from there as well
1
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
Powershell

From novice to tech pro — start learning today.