How to enabled online archiving in O365 based on DL membership

sachin kumar singh 0 Reputation points
2023-01-17T22:05:32.39+00:00

I need to implement a script where mailbox online archiving will be enabled for set of users who are member of a group.
Script can run as scheduled task and enable online archiving for newly added members in that DL.

Please if someone can help me. :)

Thank you,

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
3,766 questions
Microsoft Exchange Online
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,174 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Amit Singh 4,846 Reputation points
    2023-01-18T06:17:42.0466667+00:00

  2. Aholic Liang-MSFT 13,741 Reputation points Microsoft Vendor
    2023-01-18T10:39:37.3866667+00:00

    Hi @sachin kumar singh

    After you get all the members of this group, use the foreach loop to enable the archive mailbox for each member :

    $Members = Get-DistributionGroupMember -identity distributiongroup
    ForEach ($Member in $Members) {
    Enable-Mailbox -Identity $Member.identity  -Archive
    }
    

    (Kindly note:Users who have an archive mailbox enabled report a failure error because an archive mailbox for this mailbox already exists.)


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread