I search a script using Start-VBRWindowsFileRestore.
I want to copy a file, in fact my exchange files priv1.edb from my Veeam backup to a nas.
Any example ?

Code: Select all
$result = Get-VBRBackup | where {$_.JobName -eq "Backup Job 1"} | Get-VBRRestorePoint | sort CreationTime -Descending | select -First 1 | Start-VBRWindowsFileRestore
$file = $result.FirstDrive + “:\readme.txt”
Copy $file c:\
Stop-VBRWindowsFileRestore
Code: Select all
Stop-VBRWindowsFileRestore $Result
Code: Select all
Get-VBRBackup | where {$_.jobname -eq "Name of your job"} | Get-VBRRestorePoint | where {$_.name -eq "Name of your VM"} | Sort-Object creationtime -Descending | Select-Object -First 1
Code: Select all
Import-Module Veeam.Backup.Powershell
#Set $servername to value of first command line argument
$servername=$args[0]
#Start windows file restore session
#Try gathering restore point into variable
#This seems to fail unless the server name is explicitly specified. The below command does not work.
$restorepoint = Get-VBRRestorePoint -name $servername | Sort-Object creationtime -Descending | Select-Object -First 1
$Logrestorepoint = "Echo value of restorepoint"
Write-output $Logrestorepoint
Write-output $restorepoint
$Logrestorepoint | out-file -FilePath c:\temp\Test_Script_2.log -append
$restorepoint | out-file -FilePath c:\temp\Test_Script_2.log -append
#Actually start the Windows file restore session
$LogStartrestore = "Starting file restore"
Write-Output $LogStartrestore
$LogStartrestore | out-file -FilePath c:\temp\Test_Script_2.log -append
$result = Get-VBRRestorePoint -name $servername | Sort-Object creationtime -Descending | Select-Object -First 1 | Start-VBRWindowsFileRestore
$RestSession = Get-VBRRestoreSession | select -first 3
#This fails to produce any output
$LogRestSession = "Echo contents of RestSession"
Write-output $LogRestSession
Write-output $RestSession
$LogRestSession | out-file -FilePath c:\temp\Test_Script_2.log -append
$RestSession | out-file -FilePath c:\temp\Test_Script_2.log -append
#Display the contents of $result
Write-output "Echo contents of $result"
$result
$session = Get-VBRRestoreSession
#This fails to produce any output (write-host behaves the same)
$Logservername = "Echo contentes of servername"
Write-output $Logservername
Write-output $servername
$Logservername | out-file -FilePath c:\temp\Test_Script_2.log -append
$servername | out-file -FilePath c:\temp\Test_Script_2.log -append
#Retrieve list of volumes available to restore from
$Volumes = Get-VBRWindowsGuestItem -Session $session[0]
#Show available volumes to restore
$Logvolumes = "Echo available volumes to restore"
Write-output $Logvolumes
Write-output $Volumes
$Logvolumes | out-file -FilePath c:\temp\Test_Script_2.log -append
$Volumes | out-file -FilePath c:\temp\Test_Script_2.log -append
#Stop restore session
Stop-VBRWindowsFileRestore $Result
#Validate restore session is stopped
$RestsessionFinal = Get-VBRRestoreSession | select -first 3
#Show status of restore session - should be stopped
$LogrestessionFinal = "Echo final status of restore session"
Write-Output $LogrestessionFinal
Write-Output $RestsessionFinal
$LogrestessionFinal | out-file -FilePath c:\temp\Test_Script_2.log -append
$RestsessionFinal | out-file -FilePath c:\temp\Test_Script_2.log -append
*************** End - Script contents: Test_Script_2a.ps1 ****************
*************** Start - Log file contents: Test_Script_2.log ****************
Echo value of restorepoint
VM Name Creation Time Type
------- ------------- ----
WebServer1 5/5/2023 12:01:45 AM Increment
Starting file restore
*************** End - Log file contents: Test_Script_2.log ****************
*************** Start - Powershell Transcript file **************************************
Windows PowerShell transcript start
Start time: 20230505093038
Username: Company\usernameA
RunAs User: Company\usernameA
Machine: VeeamServerA (Microsoft Windows NT 6.3.9600.0)
Host Application: C:\Windows\system32\windowspowershell\v1.0\powershell.exe -NoExit . "C:\Program Files\Veeam\Backup and Replication\Console\Initialize-VeeamToolkit.ps1""
Process ID: 3844
PSVersion: 5.1.14409.1018
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14409.1018
BuildVersion: 10.0.14409.1018
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is C:\Users\usernameA\Documents\PowerShell_transcript.VeeamServerA.NXQ2UlNX.20230505093038.txt
PS C:\scripts> .\Test_Script_2a.ps1 "WebServer1"
WARNING: The names of some imported commands from the module 'Veeam.Backup.PowerShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
Echo value of restorepoint
VM Name Creation Time Type
------- ------------- ----
WebServer1 5/5/2023 12:01:45 AM Increment
Starting file restore
PS C:\scripts> TerminatingError(): "System error."
Info : Veeam.Backup.Model.CRestoreSessionInfo
Uid : c1e4b95da2a94bcd950e7e8c9a90dc42
LeaseUid : bcf1cafef9f54bd19a28660be86baccd
Initiator : Veeam.Backup.Model.CBaseSessionInfo+SInitiator
OibId : c8dd103d-7ec6-4893-8625-32e26d7eb310
OibUid : c8dd103d7ec64893862532e26d7eb310
SourcePlatform : EVmware
TargetPlatform : EVmware
Options : <FlrInfo BackupName="WebServer1" OibDT="05/05/2023 00:01:45" MountId="00000000-0000-0000-0000-000000000000"
MountSourceId="00000000-0000-0000-0000-000000000000" IsVbo="False" JobId="00000000-0000-0000-0000-000000000000"
JobType="0"><Data OibId="c8dd103d-7ec6-4893-8625-32e26d7eb310" IsVbrSvcRestoreOwner="False" PermittedExtentions=""
InitiatorName="Company\usernameA" InitiatorSid="S-1-5-21-3771090882-3538679689-3568416434-76188"
ShareCredsId="00000000-0000-0000-0000-000000000000" EsxId="00000000-0000-0000-0000-000000000000" PoolRef=""
FolderRef="" IsWinFlrFromSanSnapshot="False" Reason="Started by Powershell at 5/5/2023 9:31:57 AM." CreatorType="2"
IsEnterpriseRestore="False" CloudConnHostId="00000000-0000-0000-0000-000000000000"
CloudProviderId="00000000-0000-0000-0000-000000000000" GuestCredsId="00000000-0000-0000-0000-000000000000"
IsGuiFlrRequest="False" ComlpeteTaskSessionOnFinished="False" CancelExistingRestoreTask="False"
AppliencePlatform="0" MountHostId="00000000-0000-0000-0000-000000000000" UseHostApiForOriginalVm="False"
OverwriteItems="False"><AppliancePlatform PlatformId="00000000-0000-0000-0000-000000000000" Platform="0"
/></Data></FlrInfo>
StateXml : <StateXml />
RestoreSessionAudit : Veeam.Backup.Core.CRestoreSessionAudit
ItemsRestoreAudit :
ParentIdOrNull :
FileLogger : Veeam.Backup.Core.FileCommanderLogger
RestoreType : SingleRestore
MultiRestoreId : c4d4eee5-c4a9-472d-a43b-6da0a78e20c6
IsPermanent : False
SessionInfo : Veeam.Backup.Model.CRestoreSessionInfo
Id : c1e4b95d-a2a9-4bcd-950e-7e8c9a90dc42
LeaseId : bcf1cafe-f9f5-4bd1-9a28-660be86baccd
JobType : FileLevelRestore
JobName : FLR_[WebServer1]
Name : FLR_[WebServer1]
JobSpec :
JobTypeString : Guest File Restore (Windows)
CreationTime : 5/5/2023 9:32:27 AM
TrackedByVbr : True
CreationTimeUTC : 5/5/2023 9:32:27 AM
Operation :
Description :
BaseProgress : 0
IsCompleted : False
IsWorking : True
IsStarting : False
IsPostprocessing : False
JobId : 9eca9e49-dc55-46a3-974c-32c9d26688bc
JobUid : 9eca9e49-dc55-46a3-974c-32c9d26688bc
Result : None
State : Working
EndTime : 1/1/1900 12:00:00 AM
EndTimeUTC : 1/1/1900 12:00:00 AM
AuxData : <AuxData><SessionStarterInfo Version="1" UserName="usernameA" UserDomainName="META" RunManually="True"
LoginType="4" LoginName="veeamAccount" /></AuxData>
IsLowerAgentPriority : False
LogName : FLR__WebServer1_
LogsSubFolder : FLRSessions\Windows\FLR__WebServer1_
Logger : Veeam.Backup.Core.XmlLogger
Tracer : Veeam.Backup.Core.CSessionLogTracer
Info : Veeam.Backup.Model.CRestoreSessionInfo
Uid : a2b468f57060495ab150e9ea265a3644
LeaseUid : 6c2dd62aab1e48c5a523d02db89b5383
Initiator : Veeam.Backup.Model.CBaseSessionInfo+SInitiator
OibId : e28a909e-1609-4b49-86e9-a32a8d539ba4
OibUid : e28a909e16094b4986e9a32a8d539ba4
SourcePlatform : EVmware
TargetPlatform : EVmware
Options : <FlrInfo BackupName="File Servers" OibDT="05/04/2023 00:02:11" MountId="00000000-0000-0000-0000-000000000000"
MountSourceId="00000000-0000-0000-0000-000000000000" IsVbo="False" JobId="00000000-0000-0000-0000-000000000000"
JobType="0"><Data OibId="e28a909e-1609-4b49-86e9-a32a8d539ba4" IsVbrSvcRestoreOwner="False" PermittedExtentions=""
InitiatorName="Company\usernameA" InitiatorSid="S-1-5-21-3771090882-3538679689-3568416434-76188"
ShareCredsId="00000000-0000-0000-0000-000000000000" EsxId="00000000-0000-0000-0000-000000000000" PoolRef=""
FolderRef="" IsWinFlrFromSanSnapshot="False" Reason="Started by Powershell at 5/5/2023 9:26:31 AM." CreatorType="2"
IsEnterpriseRestore="False" CloudConnHostId="00000000-0000-0000-0000-000000000000"
CloudProviderId="00000000-0000-0000-0000-000000000000" GuestCredsId="00000000-0000-0000-0000-000000000000"
IsGuiFlrRequest="False" ComlpeteTaskSessionOnFinished="False" CancelExistingRestoreTask="False"
AppliencePlatform="0" MountHostId="00000000-0000-0000-0000-000000000000" UseHostApiForOriginalVm="False"
OverwriteItems="False"><AppliancePlatform PlatformId="00000000-0000-0000-0000-000000000000" Platform="0"
/></Data></FlrInfo>
StateXml : <StateXml />
RestoreSessionAudit : Veeam.Backup.Core.CRestoreSessionAudit
ItemsRestoreAudit :
ParentIdOrNull :
FileLogger : Veeam.Backup.Core.FileCommanderLogger
RestoreType : SingleRestore
MultiRestoreId : 4ffc120d-ed8d-49fe-b3f0-f452d5866841
IsPermanent : False
SessionInfo : Veeam.Backup.Model.CRestoreSessionInfo
Id : a2b468f5-7060-495a-b150-e9ea265a3644
LeaseId : 6c2dd62a-ab1e-48c5-a523-d02db89b5383
JobType : FileLevelRestore
JobName : FLR_[WebServer2]
Name : FLR_[WebServer2]
JobSpec :
JobTypeString : Guest File Restore (Windows)
CreationTime : 5/5/2023 9:27:01 AM
TrackedByVbr : True
CreationTimeUTC : 5/5/2023 9:27:01 AM
Operation :
Description :
BaseProgress : 0
IsCompleted : True
IsWorking : False
IsStarting : False
IsPostprocessing : False
JobId : 3bf52556-e828-4b9e-8df6-bbee4d9a33f3
JobUid : 3bf52556-e828-4b9e-8df6-bbee4d9a33f3
Result : Failed
State : Stopped
EndTime : 5/5/2023 9:28:04 AM
EndTimeUTC : 5/5/2023 9:28:04 AM
AuxData : <AuxData><SessionStarterInfo Version="1" UserName="usernameA" UserDomainName="META" RunManually="True"
LoginType="4" LoginName="veeamAccount" /></AuxData>
IsLowerAgentPriority : False
LogName : FLR__WebServer2_
LogsSubFolder : FLRSessions\Windows\FLR__WebServer2_
Logger : Veeam.Backup.Core.XmlLogger
Tracer : Veeam.Backup.Core.CSessionLogTracer
Info : Veeam.Backup.Model.CRestoreSessionInfo
Uid : b449ab634610482282b3aa99fafe7682
LeaseUid : 4d72a46d05e74c6595db34a84e15b14b
Initiator : Veeam.Backup.Model.CBaseSessionInfo+SInitiator
OibId : e28a909e-1609-4b49-86e9-a32a8d539ba4
OibUid : e28a909e16094b4986e9a32a8d539ba4
SourcePlatform : EVmware
TargetPlatform : EVmware
Options : <FlrInfo BackupName="File Servers" OibDT="05/04/2023 00:02:11" MountId="00000000-0000-0000-0000-000000000000"
MountSourceId="00000000-0000-0000-0000-000000000000" IsVbo="False" JobId="00000000-0000-0000-0000-000000000000"
JobType="0"><Data OibId="e28a909e-1609-4b49-86e9-a32a8d539ba4" IsVbrSvcRestoreOwner="False" PermittedExtentions=""
InitiatorName="Company\usernameA" InitiatorSid="S-1-5-21-3771090882-3538679689-3568416434-76188"
ShareCredsId="00000000-0000-0000-0000-000000000000" EsxId="00000000-0000-0000-0000-000000000000" PoolRef=""
FolderRef="" IsWinFlrFromSanSnapshot="False" Reason="Started by Powershell at 5/5/2023 9:17:03 AM." CreatorType="2"
IsEnterpriseRestore="False" CloudConnHostId="00000000-0000-0000-0000-000000000000"
CloudProviderId="00000000-0000-0000-0000-000000000000" GuestCredsId="00000000-0000-0000-0000-000000000000"
IsGuiFlrRequest="False" ComlpeteTaskSessionOnFinished="False" CancelExistingRestoreTask="False"
AppliencePlatform="0" MountHostId="00000000-0000-0000-0000-000000000000" UseHostApiForOriginalVm="False"
OverwriteItems="False"><AppliancePlatform PlatformId="00000000-0000-0000-0000-000000000000" Platform="0"
/></Data></FlrInfo>
StateXml : <StateXml />
RestoreSessionAudit : Veeam.Backup.Core.CRestoreSessionAudit
ItemsRestoreAudit :
ParentIdOrNull :
FileLogger : Veeam.Backup.Core.FileCommanderLogger
RestoreType : SingleRestore
MultiRestoreId : e9dea459-ac0a-47d9-a308-5a8aa2e81ab0
IsPermanent : False
SessionInfo : Veeam.Backup.Model.CRestoreSessionInfo
Id : b449ab63-4610-4822-82b3-aa99fafe7682
LeaseId : 4d72a46d-05e7-4c65-95db-34a84e15b14b
JobType : FileLevelRestore
JobName : FLR_[WebServer2]
Name : FLR_[WebServer2]
JobSpec :
JobTypeString : Guest File Restore (Windows)
CreationTime : 5/5/2023 9:17:33 AM
TrackedByVbr : True
CreationTimeUTC : 5/5/2023 9:17:33 AM
Operation : Operation was canceled by user Company\usernameA
Description :
BaseProgress : 0
IsCompleted : False
IsWorking : False
IsStarting : False
IsPostprocessing : False
JobId : b6bb9396-8a3e-4d93-be33-1a0299efbd00
JobUid : b6bb9396-8a3e-4d93-be33-1a0299efbd00
Result : None
State : Stopping
EndTime : 1/1/1900 12:00:00 AM
EndTimeUTC : 1/1/1900 12:00:00 AM
AuxData : <AuxData><SessionStarterInfo Version="1" UserName="usernameA" UserDomainName="META" RunManually="True"
LoginType="4" LoginName="veeamAccount" /></AuxData>
IsLowerAgentPriority : False
LogName : FLR__WebServer2_
LogsSubFolder : FLRSessions\Windows\FLR__WebServer2_
Logger : Veeam.Backup.Core.XmlLogger
Tracer : Veeam.Backup.Core.CSessionLogTracer
Users browsing this forum: No registered users and 21 guests