Powershell to determine active mailbox on Exchange Server 2010

People,

How can we determine the number of active user in the mailbox server using Powershell ?
LVL 9
Senior IT System EngineerIT ProfessionalAsked:
Who is Participating?
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.

FOXActive Directory/Exchange EngineerCommented:
Not certain if there is an actual command to output active mailboxes but this link can get you closer to your goal.

https://exchangeserverpro.com/counting-exchange-server-2010-mailboxes-powershell/
0
Senior IT System EngineerIT ProfessionalAuthor Commented:
@Fox,

I've done it already using the Powershell script below:

Get-MailboxServer | Get-Mailbox -ResultSize Unlimited | Measure-Object

Open in new window


But how to know if the mailbox is still in use or not ?
0
Muhammad BurhanManager I.T.Commented:
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Greg BessoIT Solutions EngineerCommented:
You should try the Get-MailboxStatistics -Identity 'username' | fl * to check out the LastLogonTime and LastLogoffTime attributes that it returns.
0
Vaseem MohammedCommented:
check if this works
Get-Mailbox –Resultsize Unlimited | Get-MailboxStatistics | Sort LastLogonTime | select Displayname, lastlogontime

Open in new window

you can export to .csv
Get-Mailbox –Resultsize Unlimited | Get-MailboxStatistics | Sort LastLogonTime | select Displayname, lastlogontime | Export-CSV -Path d:\Mailbox-Logon-Report.csv -NoTypeInformation

Open in new window

Add additional properties to select statement as required.

Hope that helps.
0
Vaseem MohammedCommented:
You can also use "Date" comparison using (Get-Date).adddate(-30) and the LogonTime value to check users who has logged in last 30 days from the current date.
0
Senior IT System EngineerIT ProfessionalAuthor Commented:
@Vaseem,

Yes please, how to include that date older than 90 days into the script that you've suggested ?
0
Vaseem MohammedCommented:
Use a variable to store the value of (get-date).adddays(-90)
Compare the result in the variable to the value in lastlogontime
Logic would be, if lastlogontime is greater than value in variable then collect those user details else discard.
I can't give you a working script as am on vacation ;-)
1
Senior IT System EngineerIT ProfessionalAuthor Commented:
Thanks Vaseem,

let us know when you back from the vacation :-)
0
Vaseem MohammedCommented:
Hi,
This will give you the results you are looking for.
Get-Mailbox –Resultsize unlimited -RecipientTypeDetails UserMailbox | Get-MailboxStatistics | where {$_.lastlogontime -ge ((get-date).AddDays(-90))} | Sort LastLogonTime | select Displayname, lastlogontime | Export-CSV -Path d:\Active-Mailbox-Logon-Report.csv -NoTypeInformation

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
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
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.