PowerShell script exchange
Post Reply
nunciate
Expert
Posts: 176
Liked: 23 times
Joined: May 21, 2013 9:08 pm
Full Name: Alan Wells
Contact:

Possible PowerShell Command Issue

Post by nunciate » Feb 06, 2017 3:41 pm

Can I have some folks test this for me to see if it is just me or a global issue.
This is using B&R v9.5 U1. It worked in 9.0 before I upgraded.

Create 2 Tape Jobs. Assign them both to the same Standard Media Pool
Change the second job to start after the first job.

Use the following command to change the media pool to a different pool on the second job.
Tell me if your chain is now broken. It breaks the chain on all of my jobs and I have tested several times.

Set-VBRBackupToTapeJob -Job "INSERT JOB NAME" -FullBackupMediaPool "INSERT NEW MEDIA POOL NAME"

nunciate
Expert
Posts: 176
Liked: 23 times
Joined: May 21, 2013 9:08 pm
Full Name: Alan Wells
Contact:

Re: Possible PowerShell Command Issue

Post by nunciate » Feb 06, 2017 8:06 pm

I just tested this on a Dev B&R server. Same result.
The console view of the job changes so that the Next Run column only shows After {}
If you edit the job the schedule to start After this job shows the first job alphabetically in the All jobs listing.
You can change it back to the original another setting and that puts it back but will lose the setting if the command is run again.

Case # 02059900 has been submitted

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Feb 07, 2017 8:47 am

I've just confirmed the experienced behaviour in my lab. We're investigating this internally, will let you know once I have more information.

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Feb 07, 2017 10:35 am

This has been tracked as a bug. We're planning to fix in Update 2. Thank you for raising this issue; appreciated.

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

[MERGED] Set tape job schedule

Post by zuldan » Feb 16, 2017 10:59 am

I'm trying to configure a tape job to run on the first Saturday of every month at 9:00PM. I'm after the following settings.

Image

I've tried the following commands. Neither of them work. Both sets run perfectly fine without any errors.

Code: Select all

$TapeMonthlyOption = New-VBRMonthlyOptions -DayOfWeek Saturday -DayNumberInMonth First -Period '21:00'
$TapeSchedule = New-VBRBackupToTapeScheduleOptions -MonthlyOptions $TapeMonthlyOption -Enabled  
$TapeJob | Set-VBRBackupToTapeJob -ScheduleOptions $TapeSchedule
and also

Code: Select all

$TapeJob | Set-VBRJobSchedule -Monthly -At '21:00' -NumberInMonth First -Days Saturday | Enable-VBRJobSchedule
Any help would be greatly appreciated. I'm using 9.5 U1.

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Set tape job to run after backup job

Post by zuldan » Feb 16, 2017 11:08 am

I'm trying to configure a tape job to run after a backup job. The commands run without any errors but I noticed in the console the "Next run" is '[]' and doesn't specify the job that it will run after. However, if I manually edit the tape job and set it to run after a backup job, "Next run" correctly shows the backup job in the console. Is there another command I'm supposed to be using to update the console?

Image

Code: Select all

$TapeSchedule = New-VBRBackupToTapeScheduleOptions -Type AfterJob -Job $Job -Enabled
$TapeJob | Set-VBRBackupToTapeJob -ScheduleOptions $TapeSchedule
Any help would be greatly appreciated. I'm using 9.5 U1.

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Feb 18, 2017 11:14 am

Looks like both reported issues are related to the known problem mentioned above. Kindly, wait till Update 2 is released. Thanks.

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Re: Possible PowerShell Command Issue

Post by zuldan » Feb 18, 2017 6:41 pm

Thanks for confirming v.Eremin. Looking forward to Update 2.

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Feb 19, 2017 2:18 pm

I will most likely update this thread, once the it's released. So, stay tuned.

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Re: Possible PowerShell Command Issue

Post by zuldan » Mar 14, 2017 4:03 am

Just something else to add to the list, looks like many of the Tape powershell cmdlets are broken.

1. -AlwaysCopyFromLatestFull in Add-VBRBackupToTapeJob does not enable "Process latest full backup chain only" on the job.

2. Set-VBRBackupToTapeJob -JobScriptOptions $ScriptOptions seems to 'reset' some scheduled options. Can't remember exactly would options would go to factory settings.

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Mar 14, 2017 12:04 pm

1. -AlwaysCopyFromLatestFull in Add-VBRBackupToTapeJob does not enable "Process latest full backup chain only" on the job.
I was not able to reproduce that on 9.5 Update 1.
2. Set-VBRBackupToTapeJob -JobScriptOptions $ScriptOptions seems to 'reset' some scheduled options. Can't remember exactly would options would go to factory settings.
This issue is similar to the ones mentioned previously (Set-VBRBackupToTapeJob resets the specified schedule). It's planned to be addressed in Update 2.

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Re: Possible PowerShell Command Issue

Post by zuldan » Mar 14, 2017 11:11 pm

Thanks for the reply v.Eremin. Regarding issues 1.

I cannot get the option enabled. Maybe it breaks when using a combination of other parameters? Here is my exact code below.

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn

$TapePool = 'Onsite Tapes'

$JobList = Get-VBRJob | Where-Object -FilterScript { $PSItem.JobTargetType -eq 'Backup' }

foreach ($Job in $JobList)
{
    if ($null -eq (Get-VBRTapeJob -Name "$TapePool - $($Job.Name)" -ErrorAction SilentlyContinue))
    {
        Write-Host -Object "`nCreating tape job: $TapePool - $($Job.Name)"
        Write-host -Object "$TapePool - $($Job.Name): Adding $($Job.Name)"

        # Create Tape Job and add backup job
        $Mediapool = Get-VBRTapeMediaPool -Name $TapePool
        $TapeJob = Add-VBRBackupToTapeJob -Name "$TapePool - $($Job.Name)" -Object $Job -FullBackupMediaPool $Mediapool -ProcessIncrementalBackup -IncrementalBackupMediaPool $Mediapool -ExportDays Friday -AlwaysCopyFromLatestFull
        
        # Configure Tape Job to start after backup job
        $TapeSchedule = New-VBRBackupToTapeScheduleOptions -Type AfterJob -Job $Job -Enabled
        $TapeJob | Set-VBRBackupToTapeJob -ScheduleOptions $TapeSchedule
    }
}

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Mar 15, 2017 10:45 am

Before we dig deep into the code, can you tell what product version is in use?

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Re: Possible PowerShell Command Issue

Post by zuldan » Mar 15, 2017 10:48 am

I'm using using 9.5 U1.

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Mar 15, 2017 5:39 pm

Last call of Set-VBRBackupToTapeJob seems to erase the said setting. So, in order to be of the safe side use it along with -IncrementalBackupMediaPool parameter. Thanks.

zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Re: Possible PowerShell Command Issue

Post by zuldan » Mar 16, 2017 10:53 am

Thanks v.Eremin I managed to get it working. I've included the modified code below in case anyone else has the issue.

Would you like me to open a case for this bug or will it be fixed along with the rest of the tape cmdlet fixes?

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn

$TapePool = 'Onsite Tapes'

$JobList = Get-VBRJob | Where-Object -FilterScript { $PSItem.JobTargetType -eq 'Backup' }

foreach ($Job in $JobList)
{
    if ($null -eq (Get-VBRTapeJob -Name "$TapePool - $($Job.Name)" -ErrorAction SilentlyContinue))
    {
        Write-Host -Object "`nCreating tape job: $TapePool - $($Job.Name)"
        Write-host -Object "$TapePool - $($Job.Name): Adding $($Job.Name)"

        # Create Tape Job and add backup job
        $Mediapool = Get-VBRTapeMediaPool -Name $TapePool
        $TapeJob = Add-VBRBackupToTapeJob -Name "$TapePool - $($Job.Name)" -Object $Job -FullBackupMediaPool $Mediapool -ProcessIncrementalBackup -IncrementalBackupMediaPool $Mediapool -ExportDays Friday -AlwaysCopyFromLatestFull
        
        # Configure Tape Job to start after backup job
        $TapeSchedule = New-VBRBackupToTapeScheduleOptions -Type AfterJob -Job $Job -Enabled

        # AlwaysCopyFromLastestFull used here again because Set-VBRBackupToTapeJob clears the option
        $TapeJob | Set-VBRBackupToTapeJob -ScheduleOptions $TapeSchedule -AlwaysCopyFromLatestFull
    }
}

veremin
Product Manager
Posts: 16691
Liked: 1393 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Possible PowerShell Command Issue

Post by veremin » Mar 16, 2017 11:29 am

It seems to be a general problem with Set-VBRBackupToTape job that this cmdlet resets all settings besides those that are specified. We're well aware of this issue and going to address it in one of the next product releases. Thanks.

efd121
Enthusiast
Posts: 30
Liked: 2 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:

[MERGED] Adding job to tape job is changing schedule

Post by efd121 » Jul 05, 2017 4:01 pm

I'm attempting to add a Backup job to an existing tape job and when I use the code below its changing the job schedule to be After a Backup Job
I don't want this script to change the schedule, it just needs to add a new Backup Job.
The job it added happened to be the first one when sorted alphabetically
The results are the same with or without adding the $SchedOptions object to Set-VBRBackupToTapeJob
Dave

$TapeJob = Get-VBRTapeJob -Name <My Job Name>
$NewJob = Get-VBRJob -Name <Job to Add>
$NewObject = $TapeJob.Object
$NewObject += $NewJob
$SchedOptions = $TapeJob.ScheduleOptions
Set-VBRBackupToTapeJob -Job $TapeJob -Object $NewObject -ScheduleOptions $SchedOptions

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest