Avatar of Albert Widjaja
Albert Widjaja
Flag for Australia asked on

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 ?
ExchangeActive DirectoryPowershell

Avatar of undefined
Last Comment
Wasim Shaikh

8/22/2022 - Mon
SOLUTION
FOX

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Albert Widjaja

ASKER
@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 ?
SOLUTION
Muhammad Burhan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Greg Besso

You should try the Get-MailboxStatistics -Identity 'username' | fl * to check out the LastLogonTime and LastLogoffTime attributes that it returns.
Wasim Shaikh

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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Wasim Shaikh

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.
Albert Widjaja

ASKER
@Vaseem,

Yes please, how to include that date older than 90 days into the script that you've suggested ?
Wasim Shaikh

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 ;-)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Albert Widjaja

ASKER
Thanks Vaseem,

let us know when you back from the vacation :-)
ASKER CERTIFIED SOLUTION
Wasim Shaikh

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.