PowerShell for MRM and Default Retention Policy

Hello Gang,

I work for a company with many databases and my goal is to work with one database at a time to select all users in the database that have a mailbox of 1.5GB or less and be able to apply the default retention policy to just those users and I have searched everywhere I cannot find out how to accomplish this. Can anyone please help me determine how to accomplish this? I'm guessing a PowerShell command with the use of a CSV. I know how to get a list of all users in a database with mailboxes of 1.5 or below, but that's where my information ends.

Many thanks for help!

RT 

July 11th, 2015 2:46pm

You can achieve your goal either by using pipeline or CSV.

1. Pipeline get | set

Get-Mailbox | Get-MailboxStatistics | where {$_.totalitemsize -gt 1.5GB} | Set-Mailbox -RetentionPolicy "Name of RP"


2. Applying the same setting from CSV file. Format of mailboxes.csv and PowerShell script:

Identity
User1@domain.com
User2@domain.com
User3@domain.com

Script:

Import-csv mailboxes.csv | foreach {Set-Mailbox -Identity $_.Identity -RetentionPolicy "Name of RP"}


Free Windows Admin Tool Kit Click here and download it now
July 11th, 2015 4:57pm

Thank you very much Slava!!  I look forward to testing it out next week!

Cheers,

RT

July 11th, 2015 8:42pm

You can achieve your goal either by using pipeline or CSV.

1. Pipeline get | set

Get-Mailbox | Get-MailboxStatistics | where {$_.totalitemsize -gt 1.5GB} | Set-Mailbox -RetentionPolicy "Name of RP"


2. Applying the same setting from CSV file. Format of mailboxes.csv and PowerShell script:

Identity
User1@domain.com
User2@domain.com
User3@domain.com

Script:

Import-csv mailboxes.csv | foreach {Set-Mailbox -Identity $_.Identity -RetentionPolicy "Name of RP"}


Free Windows Admin Tool Kit Click here and download it now
July 11th, 2015 8:55pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics