Check this article if this can help - https://learn.microsoft.com/en-us/microsoft-365/compliance/enable-archive-mailboxes?view=o365-worldwide
How to enabled online archiving in O365 based on DL membership
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,
2 answers
Sort by: Most helpful
-
-
Aholic Liang-MSFT 13,846 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