none
DPM PSH examples not working RRS feed

  • Question

  • Hi. I'm trying to automate recovery in DPM 2010 SP1, but I got stuck rather early.

    I was trying to enumerate recoverable items, so I've followed the example given by "get-gelp get-recoverableitem -example", which says the following:

    NAME
      Get-RecoverableItem
    
    SYNOPSIS
      Returns a list of recoverable items in a recovery point.
    
      Example 1
    
      $pg = Get-ProtectionGroup -DPMServerName TestingServer
      $ds = Get-Datasource -ProtectionGroup $pg
      $rp = Get-RecoveryPoint -Datasource $ds
      Get-RecoverableItem -RecoverableItem $rp -BrowseType child
    
    
      This command returns an object that can be recovered from the recovery point.
    

    $pg = GetProtectionGroup -DPMServerName <servername> works fine

    Second command though ($ds = Get-Datasource -ProtectionGroup $pg) returns the following error:

    Get-Datasource : Cannot convert 'System.Object[]' to the type 'Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.OMCommon.ProtectionGroup' required by p

    arameter 'ProtectionGroup'. Specified method is not supported.

    At line:1 char:38

    + $ds = Get-Datasource -ProtectionGroup <<<<  $pg

        + CategoryInfo          : InvalidArgument: (:) [Get-Datasource], ParameterBindingException

        + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Internal.EnterpriseStorage.Dls.UI.Cmdlet.Common.GetDatasource

     

    Can anyone help with this apparent type conversion error? How comes even the built-in examples don't work?

    Sunday, June 5, 2011 11:30 AM

Answers

  • Hi MarkosP,

     

    The reason you are getting this error is because $pg in your case might be returning more than one protection group as result. If this is the case $PG is an array and you will need to provide the array position you want the $ds to retrieve information from. This will be true for $ds and $rp if more than a one value is returned. Below is an example:

    I want to get the recovery item from a Exchange mailbox which is on protection group "Exchange Mailbox"

    PS C:\Program Files\Microsoft DPM\DPM\bin> $pg = Get-ProtectionGroup -DPMServerName (&hostname)
    PS C:\Program Files\Microsoft DPM\DPM\bin> $pg

    Name                                                                    Protection method
    ----                                                                       -----------------
    Exchange Mailbox                                                   Short-term using disk
    Bare Metal Protection                                              Short-term using disk
    SharePoint                                                             Short-term using disk

    # Because $PG returned 3 protection groups and I want an item that is on group 'Exchange Mailbox' I will use $PG[0] (Note: array numbers always starts from 0)
    PS C:\Program Files\Microsoft DPM\DPM\bin> $ds = Get-Datasource -ProtectionGroup $pg[0]
    PS C:\Program Files\Microsoft DPM\DPM\bin> $ds

    Computer                         Name                            Type
    --------                             ----                               ----
    EXCH                               Mailbox Database            Exchange Mailbox Datab
    EXCH                               First Storage Group         Exchange Mailbox Datab

    # As $ds returned 2 mailbox databases, I will use $rp[1] to retrieve information from 'First Storage Group'
    PS C:\Program Files\Microsoft DPM\DPM\bin> $rp = Get-RecoveryPoint -Datasource $ds[1]
    PS C:\Program Files\Microsoft DPM\DPM\bin> $rp

    Name                                Backup Time                       Datasource                  Location
    ----                                   -----------                           ----------                      --------
    First Storage Group            5/8/2011 3:09:16 AM          First Storage Group       Disk
    First Storage Group            5/9/2011 2:15:51 AM          First Storage Group       Disk
    First Storage Group            5/10/2011 2:02:37 AM        First Storage Group       Disk
    First Storage Group            5/11/2011 2:03:34 AM        First Storage Group       Disk

    # As $rp returned 4 items and I want the item backed up @ 5/11/2011 2:03:34 AM I will use $rp[3]

    PS C:\Program Files\Microsoft DPM\DPM\bin> Get-RecoverableItem -RecoverableItem $rp[3] -BrowseType child

    Name                                                        Backup Time                         Datasource                 Location
    ----                                                            -----------                             ----------                    --------
    DiscoverySearchMailbox{D919BA05-46...      5/11/2011 2:03:34 AM         First Storage Group      Disk
    FederatedEmail.4c1f4d8b-8179-4148-...        5/11/2011 2:03:34 AM         First Storage Group      Disk
    SystemMailbox{1f05a927-69cb-46c6-a...       5/11/2011 2:03:34 AM        First Storage Group       Disk
    SystemMailbox{e0dc1c29-89c3-4034-b...      5/11/2011 2:03:34 AM         First Storage Group      Disk

    Hope that helps

     

     

     

     

     

     

     


    Thanks, Wilson Souza - MSFT This posting is provided "AS IS" with no warranties, and confers no rights
    Tuesday, June 7, 2011 6:10 AM
    Moderator

All replies

  • Hi MarkosP,

     

    The reason you are getting this error is because $pg in your case might be returning more than one protection group as result. If this is the case $PG is an array and you will need to provide the array position you want the $ds to retrieve information from. This will be true for $ds and $rp if more than a one value is returned. Below is an example:

    I want to get the recovery item from a Exchange mailbox which is on protection group "Exchange Mailbox"

    PS C:\Program Files\Microsoft DPM\DPM\bin> $pg = Get-ProtectionGroup -DPMServerName (&hostname)
    PS C:\Program Files\Microsoft DPM\DPM\bin> $pg

    Name                                                                    Protection method
    ----                                                                       -----------------
    Exchange Mailbox                                                   Short-term using disk
    Bare Metal Protection                                              Short-term using disk
    SharePoint                                                             Short-term using disk

    # Because $PG returned 3 protection groups and I want an item that is on group 'Exchange Mailbox' I will use $PG[0] (Note: array numbers always starts from 0)
    PS C:\Program Files\Microsoft DPM\DPM\bin> $ds = Get-Datasource -ProtectionGroup $pg[0]
    PS C:\Program Files\Microsoft DPM\DPM\bin> $ds

    Computer                         Name                            Type
    --------                             ----                               ----
    EXCH                               Mailbox Database            Exchange Mailbox Datab
    EXCH                               First Storage Group         Exchange Mailbox Datab

    # As $ds returned 2 mailbox databases, I will use $rp[1] to retrieve information from 'First Storage Group'
    PS C:\Program Files\Microsoft DPM\DPM\bin> $rp = Get-RecoveryPoint -Datasource $ds[1]
    PS C:\Program Files\Microsoft DPM\DPM\bin> $rp

    Name                                Backup Time                       Datasource                  Location
    ----                                   -----------                           ----------                      --------
    First Storage Group            5/8/2011 3:09:16 AM          First Storage Group       Disk
    First Storage Group            5/9/2011 2:15:51 AM          First Storage Group       Disk
    First Storage Group            5/10/2011 2:02:37 AM        First Storage Group       Disk
    First Storage Group            5/11/2011 2:03:34 AM        First Storage Group       Disk

    # As $rp returned 4 items and I want the item backed up @ 5/11/2011 2:03:34 AM I will use $rp[3]

    PS C:\Program Files\Microsoft DPM\DPM\bin> Get-RecoverableItem -RecoverableItem $rp[3] -BrowseType child

    Name                                                        Backup Time                         Datasource                 Location
    ----                                                            -----------                             ----------                    --------
    DiscoverySearchMailbox{D919BA05-46...      5/11/2011 2:03:34 AM         First Storage Group      Disk
    FederatedEmail.4c1f4d8b-8179-4148-...        5/11/2011 2:03:34 AM         First Storage Group      Disk
    SystemMailbox{1f05a927-69cb-46c6-a...       5/11/2011 2:03:34 AM        First Storage Group       Disk
    SystemMailbox{e0dc1c29-89c3-4034-b...      5/11/2011 2:03:34 AM         First Storage Group      Disk

    Hope that helps

     

     

     

     

     

     

     


    Thanks, Wilson Souza - MSFT This posting is provided "AS IS" with no warranties, and confers no rights
    Tuesday, June 7, 2011 6:10 AM
    Moderator
  • Ah right, that's exactly my case. Too bad the error message wasn't bit clearer.

    Thanks Wilson

    Tuesday, June 7, 2011 6:54 AM
  • Thanks... I want to remove the recoverypoint but still gets the same error. but it help me to vanish the error.

    Xohaib

    Wednesday, April 11, 2012 7:01 AM