locked
Single Item Recovery for all mailboxes RRS feed

  • Question

  • This is probably an easy question for some of ya but I'm a powershell n00b, so I'm stumped.

    The objective is to enable SingleItemRecovery on all mailboxes. I found few folks suggesting parsing one command into another, like so:

    Get-MailboxDatabase <DBNAME> | Set-Mailbox -SingleItemRecoveryEanabled $true

    The problem is that we have number of Exchange 2K7 mailboxes and it doesn't like when the single item recovery command is applied to any mailbox on 2K7. The error I get is:

    Property SingleItemRecoveryEnabled can't be set on this object because it requires the object to have version 0.10 (14.
    0.100.0) or later. The object's current version is 0.1 (8.0.535.0).
        + CategoryInfo          : NotSpecified: (4:Int32) [Set-Mailbox], InvalidObjectOperationException
        + FullyQualifiedErrorId : 2512D2EE,Microsoft.Exchange.Management.RecipientTasks.SetMailbox

     

    I also tried running:

    [PS] C:\>Get-MailboxDatabase <DBNAME> | Set-Mailbox -SingleItemRecoveryEnabled $true
    The requested search root 'emptyroot.domain.com/Configuration/Services/Microsoft Exchange/Company/Administrative Groups/Exchange Administrative Group (FYDIBOHF23SPDLT)/Databases' is not within the scope of this operation. Cannot perform searches outside the scope 'child.domain.com'.
        + CategoryInfo          : NotSpecified: (0:Int32) [Set-Mailbox], ADOperationException
        + FullyQualifiedErrorId : E8B3EFAF,Microsoft.Exchange.Management.RecipientTasks.SetMailbox

     

    1. How do I apply single item recovery to all exchange 2010 mailboxes on all DBs in a DAG?

    2. It appears that scheduled script is my only option. How do I make sure that it applies the setting only to mailboxes that currently have it set to $false. Running it against mailboxes that were recently created (say last 24 hours) may not be best option because what happens if script fails, no one notices for a week and when they finally fix it a week later, we have a weeks' worth of mailboxes that haven't had it enabled? this has to be idiot-proof, therefore I'd rather run it against all that are $false (except 2K7) than recently created.

    And lastly... a gripe: Why isn't this something that can be executed on a DB level one time? Gah!

    Friday, December 2, 2011 10:49 PM

Answers

  • Hi Cynep,

     

    If you want to enable single item recovery per database, you can use this command:

     

    Get-Mailbox -Database <DatabaseName> | Set-Mailbox -SingleItemRecoveryEnabled $true

     

    Thanks,

     

     

    Evan Liu

     

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  


    Evan Liu

    TechNet Community Support

    • Marked as answer by Cynep Tuesday, December 6, 2011 3:13 PM
    Monday, December 5, 2011 12:08 PM
    Moderator
  • First, set your scope correctly:

    Set-ADServerSettings -ViewEntireForest $true

     

    Then something like:

    get-mailbox | where {$_.ExchangeVersion -eq "0.10 (14.0.100.0)"} | Set-Mailbox -SingleItemRecoveryEnabled $true

     

    Im dont understand your concern about not applying to recently created mailboxes. If its already set to $true, the script will just throw an error but will continue. But you can always build that into the script as well:

     

    get-mailbox | where {$_.ExchangeVersion -eq "0.10 (14.0.100.0)" -and {$_.SingleItemRetention -eq "False"}} | Set-Mailbox

    -SingleItemRecoveryEnabled $true

     

     


    • Edited by Andy DavidMVP Saturday, December 3, 2011 4:24 PM
    • Proposed as answer by Evan LiuModerator Monday, December 5, 2011 12:03 PM
    • Marked as answer by Cynep Tuesday, December 6, 2011 3:13 PM
    Saturday, December 3, 2011 4:23 PM

All replies

  • Please find below link may be helpful to you

     

    http://www.howexchangeworks.com/2011/07/single-item-recovery-in-exchange-2010.html

    Girishp

    Saturday, December 3, 2011 2:03 PM
  • First, set your scope correctly:

    Set-ADServerSettings -ViewEntireForest $true

     

    Then something like:

    get-mailbox | where {$_.ExchangeVersion -eq "0.10 (14.0.100.0)"} | Set-Mailbox -SingleItemRecoveryEnabled $true

     

    Im dont understand your concern about not applying to recently created mailboxes. If its already set to $true, the script will just throw an error but will continue. But you can always build that into the script as well:

     

    get-mailbox | where {$_.ExchangeVersion -eq "0.10 (14.0.100.0)" -and {$_.SingleItemRetention -eq "False"}} | Set-Mailbox

    -SingleItemRecoveryEnabled $true

     

     


    • Edited by Andy DavidMVP Saturday, December 3, 2011 4:24 PM
    • Proposed as answer by Evan LiuModerator Monday, December 5, 2011 12:03 PM
    • Marked as answer by Cynep Tuesday, December 6, 2011 3:13 PM
    Saturday, December 3, 2011 4:23 PM
  • Hi Cynep,

     

    If you want to enable single item recovery per database, you can use this command:

     

    Get-Mailbox -Database <DatabaseName> | Set-Mailbox -SingleItemRecoveryEnabled $true

     

    Thanks,

     

     

    Evan Liu

     

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  


    Evan Liu

    TechNet Community Support

    • Marked as answer by Cynep Tuesday, December 6, 2011 3:13 PM
    Monday, December 5, 2011 12:08 PM
    Moderator
  • In my original post, it stated that this command resulted in errors. Please see the OP.
    Monday, December 5, 2011 9:42 PM
  • When running against 11K mailboxes, the amount of errors would be substantial and obviously would be more time consuming to execute the command as it would run against objects that are already set, wouldn't it?
    Monday, December 5, 2011 9:44 PM
  • Hi Cynep,

     

    I see you used “Get-MailboxDatabase <DBNAME>”, not “Get-Mailbox -Database <DatabaseName>”, you should use get-mailbox to return all the mailboxes in the database.

     

    I tested in my lab (Exchange 2010 SP1), this command (Get-Mailbox -Database <DatabaseName> | Set-Mailbox -SingleItemRecoveryEnabled $true)can use to set on all the mailboxes in one database.

     

    Thanks,

     

    Evan Liu

     

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  


    Evan Liu

    TechNet Community Support

    Tuesday, December 6, 2011 4:06 AM
    Moderator
  • d'oh! that also worked. 
    Tuesday, December 6, 2011 3:12 PM