PowerShell script exchange
Post Reply
Jois
Novice
Posts: 9
Liked: never
Joined: Sep 24, 2012 1:05 pm
Contact:

Error trying to set options in veeam

Post by Jois »

Hi,
I am not very good at PS scripting and I am trying to run 2 scripts from this post http://forums.veeam.com/veeam-backup-re ... tml#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?
nefes
Veeam Software
Posts: 649
Liked: 170 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Error trying to set options in veeam

Post by nefes »

You have not defined $Job variable in your script.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Error trying to set options in veeam

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests