Link to home
Start Free TrialLog in
Avatar of Jerry Seinfield
Jerry SeinfieldFlag for United States of America

asked on

retention question

Hello Experts,


I have a client who is looking to change the default retention settings for deleted items and deleted mailboxes from the default values 14 and 30 to 365 days each one. see screenshot attached for details

Since I have 50 databases, with different names, I wonder if you can provide a PowerShell cmdlet to automate this task, instead of performing manually this task from EAC. so given a CSV input file, with the database names, can we change these settings for all the databases within the file at once?



Can you please also respond following questions?



what service should be restarted on each mailbox after changing these settings?



What is the service impact of this change?



Thanks in advance
ExchangeDBLimits.jpg
Avatar of Amit Kumar
Amit Kumar
Flag of India image

If you want to change for all then use below powershell:

get-mailboxdatabase | Set-MailboxDatabase  -MailboxRetention 45.00:00:00

Open in new window


For server wise

get-mailboxdatabase -server <ServerName> | Set-MailboxDatabase  -MailboxRetention 45.00:00:00

Open in new window

There will not be any major service impact, you just need to take care of storage capacity, in case if you are planning to retain deleted mailboxes for 365 days or more than 30 days.
Avatar of Jerry Seinfield

ASKER

so the correct cmdlet will be?

get-mailboxdatabase | Set-MailboxDatabase  -MailboxRetention 365.00:00:00

Should I restart any Exchange service on the Mailbox server?
No need to bounce any service.
can you please this command works for Exchange 2013? and has the 365 day of the year?

get-mailboxdatabase | Set-MailboxDatabase  -MailboxRetention 365.00:00:00
ASKER CERTIFIED SOLUTION
Avatar of Amit Kumar
Amit Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do one more thing apply it with CSV file.

I have attached a CSV file in which you can provide DBName,

1. don't delete First line named "Identity"
2. Replace DB01 and DB02 with your Prod DB names as you have 50 DBs so you can hit a enter then put DB name e.g.

Identity
DB01
DB02
DB03
DB04

Keep this CSV file in a folder and change your working directory in Powershell.

Now below command will import CSV with DB names and change retention period:

Import-Csv .\DBname.csv | foreach {set-mailboxdatabase $_.Identity -MailboxRetention 365.00:00:00}

Open in new window

DBname.csv
Hi Amit, the command above worked, however only changed the deleted mailboxes and set to 365, the deleted items still shows 14 days

Any ideas on why?
Deleted Item retention is diff. attribute, sorry I forgot to tell you to change procedure for that. Please find below mentioned.

You just need to replace -MailboxRetention with -DeletedItemRetention

Set-MailboxDatabase  -DeletedItemRetention 365.00:00:00.