Quantcast
Channel: Data Protection Manager - File Protection forum
Viewing all articles
Browse latest Browse all 520

Schedule recovery of file folder Powershell from DPM

$
0
0

I can recover through the DPOM console this data attempting to create a PowerShell script to do the same thing.

Here is script :

$from = (Get-Date).adddays(-36500) –f "dd-MMMM-yyyy 00:01:00"
$to = Get-Date –f "dd-MMMM-yyyy HH:mm:ss"
$pg = Get-DPMProtectionGroup -DPMServerName BLANDPMS | where { $_.FriendlyName -eq "Domain Computers"}
$ds = Get-DPMDatasource $pg | where {$_.computer -eq "EVELYNNPC"}
$so = New-SearchOption -SearchString * -FromRecoveryPoint "$from" -ToRecoveryPoint "$to" -SearchDetail filesfolders -SearchType contains -Recursive -Location "C:\"
$ri = Get-DPMRecoverableItem -Datasource $ds -SearchOption $so
$ro = New-DPMRecoveryOption -TargetServer BLANDPMS -RecoveryLocation copytofolder -FileSystem -AlternateLocation "C:\Recovery\" -OverwriteType overwrite -RecoveryType Restore
restore-DPMRecoverableItem -RecoverableItem $ri -RecoveryOption $ro

here is results of the script when I run :

PS C:\psscripts> .\Recovery.ps1
restore-DPMRecoverableItem : The specified recovery options are not valid. (ID: 31095)
Check the parameters that you are passing to the cmdlet and ensure that these parameters correspond to the data source
type that you are attempting to recover.
At C:\psscripts\Recovery.ps1:16 char:1
+ restore-DPMRecoverableItem -RecoverableItem $ri -RecoveryOption $ro
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Restore-DPMRecoverableItem], DlsException
    + FullyQualifiedErrorId : InvalidRecoveryOptions,Microsoft.Internal.EnterpriseStorage.Dls.UI.Cmdlet.RecoveryCmdLet
   s.RecoverRecoverableItem

Variables :

PS C:\psscripts> $pg

Name                                                        ProtectionMethod
----                                                        ----------------
Domain Computers                                        Short-term using disk


PS C:\psscripts> $ds

Computer                                Name                                    ObjectType
--------                                ----                                    ----------
EVELYNNPC                               User data                               Disconnected Client


PS C:\psscripts> $so


startPath        : C:\users\evelynn.domain\pictures\
searchParameters : Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.OMCommon.SearchParameters
startTime        : 10/23/1914 9:00:09 AM
endTime          : 9/28/2014 9:00:17 AM
isRecursive      : True

PS C:\psscripts> $ri

054.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk
055.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk
056.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk
057.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk
058.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk
059.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk
060.JPG                       9/27/2014 1:11:52 PM          EVELYNNPC.domain.com\U... Disk

This contains 250 items did not list all here

PS C:\psscripts> $ro


DsmProperties             : Microsoft.Internal.EnterpriseStorage.Dls.XsdClasses.MTA.DsmPropertiesType
AlternateLocation         : C:\Recovery\
LibraryId                 : 00000000-0000-0000-0000-000000000000
SourceServer              :
TargetServer              : BLANDPMS.domain.com
RecoverToReplicaFromTape  : False
IsSANRecovery             : False
ReferencedRecoveryOptions :


Viewing all articles
Browse latest Browse all 520

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>