Hello, @@Glenn Maxwell,
Welcome to the Microsoft Q&A platform!
Your syntax for both tasks look mostly correct, I just provide some test results and official documents to help you finish your goals more efficient.
1.Exporting Inactive Mailboxes to CSV
After running the command you provided above, as the screenshots shown, all the inactive mailboxes with the fields DisplayName, PrimarySMTPAddress, and WhenSoftDeleted are exported to a CSV file.
2.Removing Email Addresses from the Retention Policy
For removing email addresses from the retention policy using a CSV file, your syntax is also correct, which can be concluded from the official document.
If you want to learn more about how to delete an inactive mailbox, please refer to https://learn.microsoft.com/en-us/purview/delete-an-inactive-mailbox#remove-an-inactive-mailbox-from-a-retention-policy.
Moreover, as phemanth said, to make sure the CSV file can be found, please make your CSV file (C:\mailboxes.csv
) has a header named users
:
users
user1@contoso.com
user2@contoso.com
To end up, although your syntax both correct, please ensure that you have the necessary permissions to run these commands. Should you need more help on this, you can feel free to post back.
If the answer is helpful, please click on ACCEPT ANSWER as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.
Thank you for your support and understanding.
Best Wishes,
Alex Zhang