Error trying to set options in veeam

PowerShell script exchange

Error trying to set options in veeam

Veeam Logoby Jois » Thu Nov 20, 2014 8:23 am

Hi,
I am not very good at PS scripting and I am trying to run 2 scripts from this post veeam-backup-replication-f2/forever-incremental-only-weekly-full-t15739.html#p73343
When I run the first script, that is:
Add-PSSnapin VeeamPSSnapin
$JobOptions = Get-Vbrjob -name "Vi-test#31" | Get-VBRJobOptions
$JobOptions.BackupTargetOptions.TransformFullToSyntethic = $False
$JobOptions.BackupStorageOptions.EnableFullBackup = $False
$Job.SetOptions($JobOptions)

I get this error at line 5:

You cannot call a method on a null-valued expression.
At D:\Veeamscripts\syn_full_14\prepare.ps1:5 char:1
+ $Job.SetOptions($JobOptions)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Can anyone help me figure out why?
Jois
Novice
 
Posts: 9
Liked: never
Joined: Mon Sep 24, 2012 1:05 pm

Re: Error trying to set options in veeam

Veeam Logoby nefes » Thu Nov 20, 2014 10:42 am

You have not defined $Job variable in your script.
nefes
Veeam Software
 
Posts: 534
Liked: 125 times
Joined: Mon Dec 10, 2012 8:44 am
Full Name: Nikita Efes

Re: Error trying to set options in veeam

Veeam Logoby v.Eremin » Thu Nov 20, 2014 10:49 am

In order to make the script work, change the first lines a little bit:

Code: Select all
$Job = Get-Vbrjob -name "Vi-test#31"
$JobOptions =  $Job | Get-VBRJobOptions

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests