0 votes

Good Day

I've found what i want and is this Scripts Repository https://www.adaxes.com/script-repository/output-the-last-time-a-distribution-list-received-mail-s122.htm. Is for Exchange on-premises

Is it possible to make it in to a Report with the addition to add one more then one Distribution?

Thank you

by (340 points)
0

Hello,

Yes, it is possible. For us to provide you with details, please, clarify how you want to select groups for the report. Do you want to select all the groups manually or a scope (e. g. OU)? Any additional details and live examples will be much appreciated.

0

Hello

So, at the moment, a scope an OU. To be precise we have an OU where is called (Mail Distribution) and inside we have groups that are used for Distribution Mails. At a later time the multiple selection of group would not be bad idea. The Goal would be a Report were i can see when was a Distribution used to send mail. With timestamp and the name of the Group.

I hope I have provided some information.

1 Answer

0 votes
by (301k points)

Hello,

Thank you for clarifying. Here is the script for generating the report. For information on how to create reports, see https://www.adaxes.com/tutorials_ActiveDirectoryManagement_CreateReport.htm. In the script:

  • $messageDateColumnId – Specifies the identifier of the Date/time custom column that will store the mail delivery date. To get the identifier:
    1. In the Report-specific columns section, on the Columns tab, right-click the custom column.
    2. In the context menu, navigate to Copy and click Column ID.
    3. The column identifier will be copied to clipboard.
  • $exchangeServer - specifies the fully qualified domain name or IP address of your Exchange Server.
$messageDateColumnId = "{83354eeb-65f4-4fc8-a9b4-15ef27ea23d1}" # TODO: modify me
$exchangeServer = "exchangeServer.domain.com" # TODO: Modify me

$Context.DirectorySearcher.AppendFilter("(&(objectCategory=group)(mailNickname=*))")
$Context.DirectorySearcher.SearchParameters.PropertiesToLoad.Add("mail")
try
{
    # Connect to the Exchange Server
    $session = New-PSSession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
    Import-PSSession -session $session -AllowClobber -DisableNameChecking

    $searchIterator = $Context.DirectorySearcher.ExecuteSearch()
    while ($Context.MoveNext($searchIterator))
    {
        $searchResult = $searchIterator.Current
        $mail = $searchResult.GetPropertyByName("mail").Values[0]
        $messageTrackingLog = Get-MessageTrackingLog -Recipients $mail -ResultSize Unlimited | Select-Object sender, timestamp | Sort timestamp -Descending
        if ($NULL -eq $messageTrackingLog)
        {
            $messageDate = $NULL
        }
        else
        {
            $messageDate = $messageTrackingLog[0].TimeStamp
        }

        $Context.Items.Add($searchResult, @{$messageDateColumnId = $messageDate}, $NULL)
    }
}
finally
{
    if ($searchIterator) { $searchIterator.Dispose() }
    if ($session) { Remove-PSSession -Session $session }
}

Related questions

0 votes
1 answer

We have four OUs in Active Directory (Pending Deletion, Disabled with Mail Delegates, Disabled with HR Extensions and Disabled_Temp_Leave) that users are moved to prior to their eventual ... past 7 days have been moved to one of 4 of these OUs. Thanks!

asked Jun 3, 2021 by RayBilyk (240 points)
0 votes
1 answer

Hello, you helped us with a script to set the oof-message. Now we want to know, if it's possible to activate/deactivate the mail-forwarding option time-based. In the ... deactivate it accordingly on "param-abw-ende" Can you help me with that? Thanks Carsten

asked Nov 17, 2022 by lohnag (160 points)
0 votes
1 answer

The report criteria would be as follows, Name/Last Logon Date of any user that was disabled in the last 30 days. Furthermore, if possible, how would I publish this to the user ... run a report and/or choose which dates to run the report, on his own? TIA

asked Nov 26, 2024 by Milan.Pathak (40 points)
0 votes
1 answer

Hi, we currenlty have a business rule to send an email everytime the Title, Manager, Department, accountExpires, EmployeeType or FirstName attributes are ... Unit: %BusinessUnit% End Date: %accountExpires% Effective Date of Change: %adm-CustomAttributeDate2%

asked Feb 14, 2024 by KevC (60 points)
0 votes
1 answer

This is only to disable user account

asked 1 day ago by Erik Lovlie (20 points)
3,677 questions
3,361 answers
8,494 comments
549,317 users