PowerShell script exchange
Post Reply
Marco-ITSM
Service Provider
Posts: 1
Liked: never
Joined: Dec 21, 2016 2:33 pm
Full Name: Marco Hahnen
Contact:

[Veeam.Backup.Core.CBackupJob] - Object reference not set to an instance of an object. (v12)

Post by Marco-ITSM »

Hi,

we just upgraded our Veeam Installation from v11 to v12.

In one of our powershell scripts, I call the following function, because its faster than get-vbrjob:

Code: Select all

[Veeam.Backup.Core.CBackupJob]::GetAll()
which in v12 generates the following error:

Code: Select all

Exception calling "GetAll" with "0" argument(s): "Object reference not set to an instance of an object."
At line:1 char:1
+ [Veeam.Backup.Core.CBackupJob]::GetAll()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
Now the fun part: if i call get-vbrjob before calling the .net function, the .net function works fine afterwards.

Image

any ideas?
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: [Veeam.Backup.Core.CBackupJob] - Object reference not set to an instance of an object. (v12)

Post by david.domask »

Hi @Marco-ITSM, check my answer here:

post480167.html#p480167

Basically, this is kind of one of the risks of using .NET reflection :) It's not supported method; I get why you're using it, and hopefully we will see improvements on the officially supported cmdlets in the future, but for now you'll need to use this workaround for your scripts relying on .NET reflection.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests