I've got my script created, however it fails instantly with the below error. I've tried a mixture of various scripts on the Forum, and one of them kind of worked, but it doesn't scan all the volumes for the file. I'm not familiar with PS at all, so any help would be greatly appreciated.
Error upon running script:
Code: Select all
Get-ChildItem : Cannot find path 'C:\veeamflr\KANETREXCH01' because it does not exist.
At C:\Users\justin.morse\desktop\RestoreScript.ps1:5 char:15
+ $folders = gci <<<< "c:\veeamflr\$computer" | select-object FullName
+ CategoryInfo : ObjectNotFound: (C:\veeamflr\KANETREXCH01:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Stop-VBRWindowsFileRestore : Cannot validate argument on parameter 'FileRestore'. The argument is null. Supply a non-nu
ll argument and try the command again.
At C:\Users\justin.morse\desktop\RestoreScript.ps1:12 char:27
+ Stop-VBRWindowsFileRestore <<<< $result
+ CategoryInfo : InvalidData: (:) [Stop-VBRWindowsFileRestore], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Command.StopVBRWindowsFileResto
re
This is the Script that errors out:
Code: Select all
$computer = "KANETREXCH01"
$origfile = "_Marco"
$restoreto = "E:\Kane Transport\KANETREXCH01"
$result = Get-VBRBackup | where {$_.jobname -eq "$computer"} | Get-VBRRestorePoint | where {$_.name -eq "$computer"}| Where-Object {$_.CreationTime -like "*8/24/2015*"} | Select-Object -First 1 | Start-VBRWindowsFileRestore
$folders = gci "c:\veeamflr\$computer" | select-object FullName
foreach($folder in $folders){
if(Test-Path ($folder.fullname +(Split-Path -NoQualifier $origfile))) {
$file = ($folder.fullname +(Split-Path -NoQualifier $origfile))
Copy-Item $file $restoreto -Force -Recurse
}
}
Stop-VBRWindowsFileRestore $result
This is the script that actually works, but it doesn't scan all the volumes:
Code: Select all
#$result = Get-VBRBackup | where {$_.jobname -eq "MMC-KANETR"} | Get-VBRRestorePoint | where {$_.name -eq "KANETREXCH01"} | Where-Object {$_.CreationTime -like "*8/25/2015*"} | Select-Object -First 1 | Start-VBRWindowsFileRestore
#$Files = "\_Marco"
#$RestoreDestination = "E:\Kane Transport\KANETREXCH01"
#$File = $Result.Drives.Substring($Result.Drives.LastIndexOf(" ")).substring(1) + (split-path -NoQualifier $Files)
#Copy $File $RestoreDestination -Force -Recurse
#Stop-VBRWindowsFileRestore $Result