PowerShell script exchange
Post Reply
Peejay62
Expert
Posts: 235
Liked: 37 times
Joined: Aug 06, 2013 10:40 am
Full Name: Peter Jansen
Contact:

File(share) to tape difference in v9.5 and V10

Post by Peejay62 »

Hi,

Maybe this topic has to be placed within the scripting section, I place it here as it has something to do with fileshares. In 9.5 I make a lot of use of the Files to tape functionality. With this option I make backups of a lot of fileshares to tape. This has been working like a charm. I have done a lot of scripting to generate daily jobs selecting specific data from shares. This all was done by using the NEW-vbrfiletotapeObject cmdlet. Last week I migrated one Veeam server to V10. As of that moment my scripts are disfunctional. The added NAS functionality to V10 has changed the way one can select shares and subfolders to be backed up.

In short, I used : New-VBRFileToTapeObject -Server $BkpServer -Path "\\share\$path" -IncludeMask "$mask" -Credentials $creds. BKPserver was the Veeam backup server via which the -path was accessible and I feed a specific $path within that share as input. This doesn't work anymore in V10. There is a new way in V10 by using -NasServer and you get the \\share but no way to add a path behind it to specify the input. (-path is not available when using -NasServer). At least, I cannot find a way to add subdirs to be included in the selection. In the gui this works, but it is undoable selecting out of 900 subdirs by hand. If there are any suggestions, they are welcome!
So probably the new way is to just start using the full NAS backup feature in V10. But, as there has already been some discussion on the licensing and the costs, I cannot just start using NAS feature. We also have a multi PB fileshare environment so there will be a financial impact to that and that's something that needs to be discussed internally.
As for now, I need to get the current scripts running. I now ported the scripts to another Veeam backup server still running 9.5. We have this one planned to upgrade to V10 this weekend. If I cannot get the scripts running, I need to postpone that upgrade.

Thanks, Peter
veremin
Product Manager
Posts: 20406
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: File(share) to tape difference in v9.5 and V10

Post by veremin »

Let's take v10 NAS functionality out of this equation, as you're not using it at the moment.

So, can you please provide us with

- the goal you're trying to achieve
- the script that does not work in v10

This should allow us to assist your further.

Thanks!
Peejay62
Expert
Posts: 235
Liked: 37 times
Joined: Aug 06, 2013 10:40 am
Full Name: Peter Jansen
Contact:

Re: File(share) to tape difference in v9.5 and V10

Post by Peejay62 »

Hi, here is the script. I have stripped some things and have put some standard names in it as the original holds some private information but basically this is it. It is fairly straightforward, It reads a file that holds names of directories ( that exist within a share) to be processed and furthermore it adds a desired filemask. As you see in the New-VbrFileToTapeobject I can add a path containing the share AND the directory. I cannot get that to work anymore in V10. V10 says that the share has been added as a server automatically due to the upgrade from v9.5 and I now can add the share as a VbrNasServer but no option for a path, only the main share. The Share contains more then 500 directories of which I only need to read appx 20.

Code: Select all

#pre-script started in FileToTapeJob
#
# This scripts modifies the veeamjob FileToTapeJob
# it feeds the input for processing
# Input is a list of directories (FileWithDirectories.txt)
# and it uses as a filter the yesterday date
# goal is to backup only those files from the specific directories with the specific filter.
#
# If you look at job settings in gui at files and folders you see after script has run:
#
# file or folder                server        file masks
#\\sharedir\dir1fromList        backupserver Only *_20200429_*
#\\sharedir\dir2fromList        backupserver Only *_20200429_*
#\\sharedir\dir3fromList        backupserver Only *_20200429_*
# etc
#
$veeam_snapin="VeeamPSSnapin"
if ( (Get-PSSnapin -Name $veeam_snapin -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapIn $veeam_snapin
}
# date that needs to be processed (yesterday)
$checkdate=(Get-Date).Date.Adddays(-1).tostring(“yyyyMMdd”)  
# define the include filter for the job
$Mask="*_"+$checkdate+"_*" # files that need to be selected
# Get the tapejob
$Job=get-vbrtapejob -name FileToTapeJob
$BkpServer = get-vbrserver -name "BackupServer"
$creds = Get-VBRCredentials -name "User"
#
   $Dirlist=get-content FileWithDirectories.txt |Select-Object 
   $Dir=@()
   #
   # loop the listing and generate input statements for the veeamjob
   #
   foreach ($Dir in $Dirlist) 

    {

         $InputObj += New-VBRFileToTapeObject -Path "\\sharedir\$Dir" -IncludeMask "$mask" -Server $BkpServer  -Credentials $creds
     }
  $Object = $InputObj
  #
    # modify the existing Veeamjob to hold the new inclusion
  #
  Set-VBRFileToTapeJob -Job $Job -Object $Object
#
# job is modified with new input
#
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: File(share) to tape difference in v9.5 and V10

Post by oleg.feoktistov »

Hi Peter,

Try adding the server this share reside on to your VBR console as a managed one instead and then follow the approach I described here.

Hope that helps,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests