PowerShell script exchange
Post Reply
Joel_Miller
Novice
Posts: 7
Liked: never
Joined: Oct 03, 2018 1:22 pm
Full Name: Joel Miller
Contact:

Powershell to Mount VM Backup Volume

Post by Joel_Miller »

We just started backing up our SQL Servers using App-Aware backups. I can restore a SQL Server database using the PowerShell commands or GUI. It looks like what this process does is to first mount the backup volumes to the destination server and then copy over the mdf/ldf and then dismount the volumes.

I was wondering if there is a command that would allow me to mount a backup volume to a server so I reference the MDF/LDF and temporarily attach those database files as a database in SQL Server.

This would allow me to quickly attach the backup without doing a full restore or taking the time to copy large files. I could then execute a quick SQL command on the MDF (a SQL Query) and the detach the database files and volume.

Is this possible? I can see a huge benefit from this process. Please let me know if this sounds possible.

Thanks!
MichaelCade
Veeam Software
Posts: 315
Liked: 74 times
Joined: Mar 23, 2015 11:55 am
Full Name: Michael Cade
Location: Cambridge, United Kingdom
Contact:

Re: Powershell to Mount VM Backup Volume

Post by MichaelCade »

Guest file restore would allow the backup file to be mounted to the server and allow you see that as a mount point within, you could then navigate to the MDF / LDF files within that mount point.

https://helpcenter.veeam.com/docs/backu ... tml?ver=95
Regards,

Michael Cade
Global Technologist
Veeam Software
Email: Michael.Cade@Veeam.com
Twitter: @MichaelCade1
Joel_Miller
Novice
Posts: 7
Liked: never
Joined: Oct 03, 2018 1:22 pm
Full Name: Joel Miller
Contact:

Re: Powershell to Mount VM Backup Volume

Post by Joel_Miller »

Thanks! Using the example, I was able to mount the backup but since I am running this Powershell from my laptop, it mounted the backup to my laptop instead of a remote server. It appears that there is a -Host parameter, but when I use that (for example: -Host "SQLServer12") I receive an error:

Start-VBRWindowsFileRestore : Cannot process argument transformation on parameter 'Host'. Host with name 'SQLServer12' was not found
At line:36 char:222
+ ... lect-Object -First 1 | Start-VBRWindowsFileRestore -Host "SQLServer12"
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-VBRWindowsFileRestore], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Veeam.Backup.PowerShell.Cmdlets.StartVBRWindowsFileRestore

Am I misunderstanding that parameter?
Host - Specifies the host to which the snapshot clone/virtual copy must be mounted and on which the temporary VM must be created.
Rick.Vanover
Veeam Software
Posts: 712
Liked: 168 times
Joined: Nov 30, 2010 3:19 pm
Full Name: Rick Vanover
Location: Columbus, Ohio USA
Contact:

Re: Powershell to Mount VM Backup Volume

Post by Rick.Vanover »

One trick I have heard of the support team doing - but officially this should be done with support - but the hacker in me has fun with this... :) Is to do the following:

-Launch a Veeam FLR of the SQL Server in question (VM or Agent backup)
-On the Veeam B&R Server the C:\VeeamFLR folder will have a pointer to the file system of the system you are restoring for FLR
-If the SQL Server is local on the Veeam B&R Server - you can mount MDF/LDF right there to get what you need or you can copy the files elewhere

With that logic - it can be scripted to do other things but the VeeamFLR folder is something you could bake into automation/scripting...
MichaelCade
Veeam Software
Posts: 315
Liked: 74 times
Joined: Mar 23, 2015 11:55 am
Full Name: Michael Cade
Location: Cambridge, United Kingdom
Contact:

Re: Powershell to Mount VM Backup Volume

Post by MichaelCade »

You may need to specify FQDN for SQLServer12
Regards,

Michael Cade
Global Technologist
Veeam Software
Email: Michael.Cade@Veeam.com
Twitter: @MichaelCade1
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell to Mount VM Backup Volume

Post by veremin »

Instead of string object, specify CHost object for -Host parameter. CHost object can be returned by Get-VBRServer cmdlet. Thanks!
Joel_Miller
Novice
Posts: 7
Liked: never
Joined: Oct 03, 2018 1:22 pm
Full Name: Joel Miller
Contact:

Re: Powershell to Mount VM Backup Volume

Post by Joel_Miller »

Thanks for all the help. So far I was able to mount the volumes for an FLR and then attach the database files to get data. This was quick and easy.
The FQDN change did not make any difference.
The Get-VBRServer cmdlet does not appear to do what I need. I can pass the name of one of our Veeam Infrastructure servers and get information back about that node. However, what I am trying to accomplish is to use Start-VBRWindowsFileRestore from my workstation and tell Veeam to mount a FLR Restore on a remote server (example : SQLServer001). When I use the -Host parameter, I get the error above. If I were to use the Get-VBRServer to pass in a host, the Get-VBRServer does not return any results if I use Get-VBRServer -Name "SQLServer001.mycompany.com". It will return results when I pass in a name of the Veeam Servers themselves. However, I want to mount the backup volumes on the remote SQL Server (SQLServer001).

-Thanks!
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell to Mount VM Backup Volume

Post by veremin »

Start-VBRWindowsFileRestore from my workstation and tell Veeam to mount a FLR Restore on a remote server (example : SQLServer001).
Then, you will need to add this server to your backup server first (managed server). Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests