How to create reports for inactive users, devices and mailboxes?

Hi guys

I'm currently working on all of the licenses across our estate. I ran the Microsoft SAM tool and of course in the report we have so many users/mailboxes/devices which are over the licenses we actually have.

I'm trying to work out a way which I can get a report into an Excel sheet with the following to help me with all of the licensing:

a.  All of the people who have not accessed their mailboxes for over 2 months (the plan is to backup and then remove those mailboxes)
b. All of the mobile devices that have got Exchange emails added to them.
c. All of the computer devices that have not accessed or been active or no longer on the network.

Is this feasible? As it will hopefully help with getting rid of stale and unused records to aid me with organising our licenses.

Thanks a lot for helping
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.

IvanSystem EngineerCommented:

for (a.) you could use PS command like: get-mailbox | get-mailboxstatistics | select displayname, lastlogontime

Then simple look for users not logged for at least 2 months.


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
IvanSystem EngineerCommented:

for (b.) you could use something like this: Get-Mailbox | Get-MobileDevice | select userdisplayname, devicetype, devicemodel | Export-CSV "<path>\<name_of_file>.csv" -NoTypeInformation -Append

There will be many duplicate entries, so I guess you can sort and filter them.. There should be some better way to do it, just cant think of it atm :D

YashyAuthor Commented:
Thank you for responding Ivan. I appreciate it.
Naveen SharmaCommented:
You can also automate this process using this Active Directory Cleanup solution to identify, move or clean up inactive AD user accounts: 

Here is an article which lets you how to manage inactive user and computer accounts in Active Directory:

Hope you find this useful!
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
Microsoft Office

From novice to tech pro — start learning today.