Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Mailboxes Not Accessed for certain time

Posted on 2013-06-08
13
Medium Priority
?
851 Views
Last Modified: 2013-06-18
Hello Experts,
I have exchange 2010 SP2
I am looking for a way to get a report that list the mailboxes based on distribution group that have not been accessed in 15 day or 30 days and export them into excel format.

Please any help

Thanks
0
Comment
Question by:cciedreamer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
13 Comments
 
LVL 22

Expert Comment

by:Haresh Nikumbh
ID: 39231408
Mailboxes that have never been logged on to:

Get-MailboxStatistics -resultsize unlimited | where {$_.LastLogonTime -eq $null | ft displayName,lastlogontime,lastloggedonuseraccount,servername

List of mailboxes that haven’t been accessed in the last X days. Let’s use 7 days as the value here:

Get-MailboxStatistics -resultsize unlimited | where {$_.LastLogonTime -lt (get-date).AddDays(-7)} | ft displayName,lastlogontime,lastloggedonuseraccount,servername


Source : http://social.technet.microsoft.com/forums/en-US/exchangesvrdeploylegacy/thread/26875361-95a7-47db-ade2-47d3fc8ccf21
0
 
LVL 43

Expert Comment

by:Vasil Michev (MVP)
ID: 39231432
If you are going to filter the users based on DG membership, try something like this:

# group name goes here, or obtain it from user prompt
$members = Get-DistributionGroupMember -Identity "sec grp"

$arrResult = @()

# modify the end date here
$date = (get-date).AddDays(-15)

foreach ($m in $members) {
	$objProperties = New-Object PSObject
	$temp = Get-MailboxStatistics -Identity $m.SamAccountName

# skip users that have never logged in
	if (!$temp.LastLogonTime) { continue; }

	if ($temp.LastLogonTime -lt $date) {

# Add another properties to export as necessary

		Add-Member -InputObject $objProperties -MemberType NoteProperty -Name "DisplayName" -Value $m.DisplayName
		Add-Member -InputObject $objProperties -MemberType NoteProperty -Name "SamAccountName" -Value 

$m.SamAccountName
		Add-Member -InputObject $objProperties -MemberType NoteProperty -Name "PrimarySmtpAddress" -Value 

$m.PrimarySmtpAddress
		Add-Member -InputObject $objProperties -MemberType NoteProperty -Name "LastLogonTime" -Value 

$temp.LastLogonTime

		$arrResult += $objProperties
		}
}

# modify export path here
$arrResult | Export-Csv -Path ".\test.csv" -NoTypeInformation

Open in new window

0
 
LVL 3

Author Comment

by:cciedreamer
ID: 39231438
Hi,
Thanks for the reply. Is there any to get status based on groups.

Thanks
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 22

Expert Comment

by:Haresh Nikumbh
ID: 39231445
get-mailboxstatistics -server am-lon-ex02 | where {($_.LastLogonTime -lt (get-date).adddays(-30)) -and ($_.ObjectClass -eq "Mailbox")} | out-file mailboxes.txt
0
 
LVL 3

Author Comment

by:cciedreamer
ID: 39231531
Currently I am using Promodag reports to generate exchange reports I am not this will fulfill my requirement

Thanks
0
 
LVL 3

Author Comment

by:cciedreamer
ID: 39231572
The above script is batch file or vb script ??

Thanks
0
 
LVL 22

Expert Comment

by:Haresh Nikumbh
ID: 39231585
mine is exchange powershell
0
 
LVL 3

Author Comment

by:cciedreamer
ID: 39231607
How I can run the above command with exchange shell. Just copy and paste the above script ??
0
 
LVL 22

Expert Comment

by:Haresh Nikumbh
ID: 39231616
yes  just replace this
am-lon-ex02
your exchange server name
0
 
LVL 3

Author Comment

by:cciedreamer
ID: 39231760
Do you I have to completely copy the script ( replacing server name ) and paste it to exchange powershell.

THanks
0
 
LVL 3

Author Comment

by:cciedreamer
ID: 39232001
I ran the commands but it ended as shown and not file was createdpowershell
Please any advise.
0
 
LVL 3

Accepted Solution

by:
cciedreamer earned 0 total points
ID: 39245399
Thanks for the experts help.
I solved it myself using Promodag Reporting Tool.
0
 
LVL 3

Author Closing Comment

by:cciedreamer
ID: 39255614
Thanks for the experts help.
I solved it myself using Promodag Reporting Tool.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question