-
- Enthusiast
- Posts: 28
- Liked: never
- Joined: Aug 30, 2022 6:21 am
- Full Name: Wesley Goodall
- Contact:
Powershell script to restore a file from an agent
Hi All,
Does anyone have any experience with scripting a file level restore of a VM or Devices, but for Agents?
I already have a script for normal Veeam Fieel Level restore jobs but it won't work with agents.
Any help would be much appreciated
Kindest Regards
Wes
Does anyone have any experience with scripting a file level restore of a VM or Devices, but for Agents?
I already have a script for normal Veeam Fieel Level restore jobs but it won't work with agents.
Any help would be much appreciated
Kindest Regards
Wes
-
- Product Manager
- Posts: 14844
- Liked: 3086 times
- Joined: Sep 01, 2014 11:46 am
- Full Name: Hannes Kasparick
- Location: Austria
- Contact:
Re: Powershell script to restore a file from an agent
Hello,
just to clarify... is it about standalone agents (without Veeam Backup & Replication), or are the backups all managed by a backup server, so you need a PowerShell script for Veeam Backup & Replication?
Best regards,
Hannes
PS: I moved your question to the PowerShell forum
just to clarify... is it about standalone agents (without Veeam Backup & Replication), or are the backups all managed by a backup server, so you need a PowerShell script for Veeam Backup & Replication?
Best regards,
Hannes
PS: I moved your question to the PowerShell forum
-
- Enthusiast
- Posts: 28
- Liked: never
- Joined: Aug 30, 2022 6:21 am
- Full Name: Wesley Goodall
- Contact:
Re: Powershell script to restore a file from an agent
Thanks for the reply and moving to correct forum.
Yes backups are managed by Veeam Backup & Replication
Yes backups are managed by Veeam Backup & Replication
-
- Product Manager
- Posts: 14844
- Liked: 3086 times
- Joined: Sep 01, 2014 11:46 am
- Full Name: Hannes Kasparick
- Location: Austria
- Contact:
Re: Powershell script to restore a file from an agent
Hello,
hmm, then a combination of the examples from here and here
worked for me
can you maybe share your code and the error?
Best regards,
Hannes
hmm, then a combination of the examples from here and here
worked for me
Code: Select all
$backup = Get-VBRBackup -Name "VAW-app01*"
$restorepoint = Get-VBRRestorePoint -Backup $backup -Name "App-01.lab.intern"
$session = Start-VBRWindowsFileRestore -RestorePoint $restorepoint[1]
Best regards,
Hannes
-
- Enthusiast
- Posts: 28
- Liked: never
- Joined: Aug 30, 2022 6:21 am
- Full Name: Wesley Goodall
- Contact:
Re: Powershell script to restore a file from an agent
@HannesK
I'm currently doing the restore test by VMname , hence the complication for agents.
How would I change this to be used for agents .. I can see you are loading the job, then getting the restore point .. this actually looks like a cleaner method than what I am currently doing.
Script i'm using
Thanks for your help
Wes
I'm currently doing the restore test by VMname , hence the complication for agents.
How would I change this to be used for agents .. I can see you are loading the job, then getting the restore point .. this actually looks like a cleaner method than what I am currently doing.
Script i'm using
Code: Select all
CreationTime -Descending | where {$_.VMName -eq "$vmName"} | select -First 1
$restore = $result | Start-VBRWindowsFileRestore
# Copies the Files
foreach ($file in $originalFiles) {
# Find the FLR mount point for the specific drive letter
$flrmountpoint = ($restore.MountSession.MountedDevices | ? {$_.DriveLetter -eq (Split-Path $file -Qualifier)}).MountPoint
# Build the path to the file via the FLR mount point
$file = $flrmountpoint + (Split-Path $file -NoQualifier)
#Copy/Restore the files
Copy-Item $file $destPath -Force -recurse
}
# Stop the FLR process
Stop-VBRWindowsFileRestore $restore
Wes
-
- Product Manager
- Posts: 14844
- Liked: 3086 times
- Joined: Sep 01, 2014 11:46 am
- Full Name: Hannes Kasparick
- Location: Austria
- Contact:
Re: Powershell script to restore a file from an agent
the first lines have to be changed to select the machine. "App-01.lab.intern" is the hostname, in my case, so that should help to understand the code I pasted.
-
- Enthusiast
- Posts: 28
- Liked: never
- Joined: Aug 30, 2022 6:21 am
- Full Name: Wesley Goodall
- Contact:
Re: Powershell script to restore a file from an agent
I don't follow is it possible for you can show me where to change the code?
I did change host but think i'm missing soemthing?
I did change host but think i'm missing soemthing?
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Powershell script to restore a file from an agent
Hi Wesley,
What happens if you run the code below with the actual backup and host names?
Do you get any output with a restore point?
Best regards,
Oleg
What happens if you run the code below with the actual backup and host names?
Code: Select all
$backup = Get-VBRBackup -Name "BackupName"
$restorepoint = Get-VBRRestorePoint -Backup $backup -Name "hostName"
$restorepoint
Best regards,
Oleg
Who is online
Users browsing this forum: No registered users and 17 guests