PowerShell script exchange
Post Reply
MikeZ
Novice
Posts: 4
Liked: 1 time
Joined: Dec 02, 2021 8:04 pm
Contact:

Scripting Help

Post by MikeZ »

Hi,

I'm not fluent with Veeam powershell, more of a hack lol

Anyhow, I had this script running as a post process after backup. Basically, it just mounts the latest restore point and copies some specific files to the same server.

Code: Select all

Remove-Item 'T:\Temp\DATA' -Recurse
$origfile = "D:\DATA"
$backup = Get-VBRBackup -Name "BackupJob1"
$result = Get-VBRRestorePoint | where {$_.name -eq "server01"} | Sort-Object creationtime -Descending | Select-Object -First 1 | Start-VBRWindowsFileRestore
$flrmountpoint = ($result.MountSession.MountedDevices | ? {$_.DriveLetter -eq (Split-Path -Qualifier $origfile)}).MountPoint
$file = $flrmountpoint + (Split-Path -NoQualifier $origfile)
Copy $file T:\Temp\DATA -Recurse
Stop-VBRWindowsFileRestore $result
What has happened is I turned this server into a Veeam Datamover/Storage only so it has the repository still on it, however, the jobs have been moved to a primary Veeam BR server which is calling all the actions. Running the script on the new VeeamBR server has the issue of:

Copy-Item : Cannot find path 'C:\VeeamFLR\server01\DATA' because it does not exist.

I'm assuming it doesn't create the VeeamFLR on the mounted server? Is there a way to redirect the VeeamFLR directory and how would I go about doing that? Thanks for any help in advance!
david.domask
Veeam Software
Posts: 1253
Liked: 326 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Scripting Help

Post by david.domask »

Hi @MikeZ,

Correct, File Item Restores (and Application Item Restores) get mounted to their respective mount servers as defined here:

https://helpcenter.veeam.com/docs/backu ... ml?ver=120
(This is for Windows based Repository, but the same option applies to all Repository Types)

You can set the current VBR server to be the mount server if you like and I believe your script should work. Please note that naturally this means some traffic between the storage server and the mount server, but if it's in the same network, it shouldn't be a ton and shouldn't add much processing time. You might need to add some sleeps just to give it a little time, but I think that the Start-VBRWindowsFileRestore is always synchronous, so the script shouldn't continue until the mount is complete.

Give it a shot and see if it helps.
David Domask | Product Management: Principal Analyst
MikeZ
Novice
Posts: 4
Liked: 1 time
Joined: Dec 02, 2021 8:04 pm
Contact:

Re: Scripting Help

Post by MikeZ » 1 person likes this post

Thanks, let me give you some more details, I don't think I'm explaining it right lol

Image

So what I am seeing happening in realtime is it mounts the backup image to Server B, however, since Server A is trying to run the script, Server A is looking for the files to copy under C:\VeeamFLR which does not exist. How do I change it so the script looks at Server B instead of Server A for the VeeamFLR path?

Or can I reverse engineer this where Server B (which has no veeam installed at all) is capable of running these Veeam Powershell commands?
MikeZ
Novice
Posts: 4
Liked: 1 time
Joined: Dec 02, 2021 8:04 pm
Contact:

Re: Scripting Help

Post by MikeZ »

Actually I did reverse the process and it seems to be working. I am running the script from Server B and then using the Connect-VBRServer to Server A and it seems to work like its supposed to. Now I just need to automate it again and I'll call this good :)
david.domask
Veeam Software
Posts: 1253
Liked: 326 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Scripting Help

Post by david.domask » 1 person likes this post

Hi @MikeZ,

Well, your solution would work also :) It's basically just all about where it mounts. But if you're satisfied with this, then I'm glad :)
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests