Tracking the last login date for a mailbox or a postoffice


SUMMARY

This article describes how to track the last login date for a mailbox or a postoffice.

DETAIL

Enable and list last login date for a mailbox:

  • Open the MailEnable administration console and navigate to: Servers > Localhost
  • Right click on "Localhost" and select properties in the menu.
  • Navigate to the "Auditing" tab.
  • Click the option for "Record times for last login activity".
  • Restart all MailEnable services and also restart IIS for MailEnable web services.
  • To view the last login times for a mailbox navigate within the administration console to: Messaging Manager > Postoffices > {postoffice name} > mailboxes.
  • In the right hand pane locate the mailbox in the list and right click on the mailbox and select Properties from the popup menu.
  • The last login time for the mailbox will be listed under the "General" tab in the bottom of the window.

List the last login times for all mailboxes within a postoffice:

To list the last login times for all mailboxes that have authenticated within a postoffice requires a custom script to be created and executed in Windows PowerShell.

  • Open Notepad or any text editor and insert the following code:
param (
    [Parameter(Mandatory=$true)][string]$postoffice
)
# Ensure the snapin module is loaded (if it is not already)
if ((Get-PSSnapin -Name MailEnable.Provision.Command -ErrorAction SilentlyContinue) -eq $null)
{
    Add-PsSnapin MailEnable.Provision.Command
}
# Get the list of mailboxes in the postoffice
$lstMailboxes = Get-MailEnableMailbox -Postoffice $postoffice
ForEach($oMailbox in $lstMailboxes)
{
    $lastlogin = Get-MailEnableMailbox -Postoffice $postoffice -Mailbox $oMailbox.MailboxName -Setting "mailboxLastLogin"
    Write-Host $oMailbox.MailboxName -NoNewline
    if (0 -eq $lastlogin)
    {
        Write-Output "`tNot recorded"
    }
    else
    {
        $converted = ([datetime]'1/1/1970Z').AddSeconds($lastlogin)
        Write-Host "`t" -NoNewline
        Write-Output $converted.ToLocalTime().ToString('s')
    }
}
  • Copy Code

  • Save the file with the .ps1 file extension. I.e.: Showlastlogin.ps1
  • Open Windows PowerShell and run the script with the following command/parameter: Showlastlogin.ps1 postofficename
  • Replace postofficename with the postoffice you are querying.


Product:MailEnable (All Versions)
Category:Other
Article:ME020509
Module:General
Keywords:auth,track,events,last,login,time
Class:HOWTO: Product Instructions
Revised:Wednesday, May 11, 2022
Author:
Publisher:MailEnable