Powershell command to import backups

PowerShell script exchange

Powershell command to import backups

Veeam Logoby mwpreston » Fri Jan 21, 2011 5:53 pm

Hi,

Wondering if anyone can help me here....I'm looking for the powershell command in order to import a backup file.
What we have is a veeam server setup onsite, and one remotely. We ship the backups to the remote site every night.
On the weekend what I hope to do is automate the task of importing these backups into the veeam server, and run a surebackup job on them...

I have the powershell installed, however the command import-vbrbackup keeps telling me i'm specifying the wrong value for server....not sure what this is supposed to be...

Thanks,
Mike
mwpreston
Veeam Vanguard
 
Posts: 73
Liked: 9 times
Joined: Tue May 25, 2010 3:27 pm
Full Name: mike

Re: Powershell command to import backups

Veeam Logoby Gostev » Sun Jan 23, 2011 4:44 pm

Hi Mike, what command line do you specify?
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Powershell command to import backups

Veeam Logoby mwpreston » Wed Jan 26, 2011 1:13 pm

I've actually got the syntax down for that command now and everything is working....Thanks,
mwpreston
Veeam Vanguard
 
Posts: 73
Liked: 9 times
Joined: Tue May 25, 2010 3:27 pm
Full Name: mike

Re: Powershell command to import backups

Veeam Logoby D_M_C » Fri Apr 15, 2011 1:57 pm

Mike,

I too am looking to automate the backup imports on remote veeam server to test using SureBackup feature.
Can you post your script? We were hoping that this would be implemented in the newest version but still waiting.

Thanks,
David
D_M_C
Lurker
 
Posts: 2
Liked: never
Joined: Sat Mar 20, 2010 5:09 pm
Full Name: David Click

Re: Powershell command to import backups

Veeam Logoby mwpreston » Fri Apr 15, 2011 2:46 pm

Hi,

Here's what I have used thus far, but only have gotten as far as importing the backups.....a good starter for you though...

Code: Select all
Add-PSSnapin VeeamPSSnapin

$vbrServer = Get-VBRServer | where {$_.Type -eq "Local"}
$direct = "H:\"
$file = Get-ChildItem H:\*.vbk | %{$_.Name}
$fullfile = $direct += $file

Import-vbrbackup -server $vbrServer -FileName $fullfile

exit


Hopefully that gets you going. If you ever get it complete post back to this forum, i'd love to have the full script.
mwpreston
Veeam Vanguard
 
Posts: 73
Liked: 9 times
Joined: Tue May 25, 2010 3:27 pm
Full Name: mike

Re: Powershell command to import backups

Veeam Logoby UNHStorage » Thu Apr 13, 2017 9:14 pm

I needed to import a large amount of backup files that were in a remote Backup Repository not connected directly to the Veeam server

Here is the script I am using to import individual backup folders and all VBK files in it

Code: Select all
Add-PSSnapin VeeamPSSnapin

$vbrServer = (Get-VBRServer -Name server.domain.local).Name                  #FQDN of server that has the directory of files needing to be imported
$direct = "R:\Name_of_Folder\"                                    #Define Directory location on the remote server
$filePath = Get-ChildItem \\$vbrServer\r$\Name_of_Folder\*.vbk | %{$_.Name}         #Populate the variable with all VBK files needing to be imported from the remote directory
$totalfiles = (Get-ChildItem \\$vbrServer\r$\Name_of_Folder\*.vbk | %{$_.Name}).Count   #Total number of files in the directory
$incre = 0                                                #Incremental counter variable

ForEach($file in $filePath)
   {
   $fullfile = "$direct" + "$file"                                 #Combines directory location and file name
   $incre++                                             #Increment counter by 1
   Write-Host "Importing backup file $fullfile from $vbrServer file number $incre"      #Displays in terminal window the current file being imported and its position in line
   Import-vbrbackup -server $vbrServer -FileName $fullfile                  #Performs import of file
   Write-Host "Successfully imported file $incre of $totalfiles"                  #Displays on the screen the file import count.
   }
exit


I am sure there are ways to be more efficient with the PowerShell script, and I look forward to seeing them. But, this script is currently performing the *.vbk file import for a few thousand files that I needed pulled back into the GUI so I am :D right now.
UNHStorage
Lurker
 
Posts: 1
Liked: never
Joined: Thu Apr 13, 2017 3:32 pm
Full Name: Craig Goodspeed

Re: Powershell command to import backups

Veeam Logoby dellock6 » Mon Apr 17, 2017 8:29 am

Maybe this one can help too:
https://github.com/VeeamHub/powershell/ ... rt-Backups
The code was written with another use case in mind, but the scan and import commands are in there.

Luca
Luca Dell'Oca
EMEA Cloud Architect @ Veeam Software

@dellock6
http://www.virtualtothecore.com
vExpert 2011-2012-2013-2014-2015-2016
Veeam VMCE #1
dellock6
Veeam Software
 
Posts: 5052
Liked: 1333 times
Joined: Sun Jul 26, 2009 3:39 pm
Location: Varese, Italy
Full Name: Luca Dell'Oca


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 8 guests