PowerShell script exchange
Post Reply
micwv8
Novice
Posts: 9
Liked: never
Joined: Nov 13, 2014 2:51 am
Full Name: Michael Walkenhorst
Contact:

Veeam Report Question

Post by micwv8 » Nov 13, 2014 3:07 am

Hi,

We made the move to Veeam 8 earlier this week. It is working well.

I know Veeam Support does not cover PowerShell, so I thought I would post this question here.

One of 'my' scripts (it's actually a script I found – "My Veeam Report" from Shawn Masterson's Blog) is now broken. It is only one line that is broken though (I think).

That one broken line is:
$jobobjids = [Veeam.Backup.Core.CHierarchyObj]::GetObjectsOnHost($vcenterobj.id) | Where-Object {$_.GetItem().Type -eq "Vm"}

The error message is:
Method invocation failed because [Veeam.Backup.Core.CHierarchyObj] doesn't contain a method named 'GetItem'.
At line:1 char:98
+ ... Where-Object {$_.GetItem().Type -eq "Vm"}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound


Would anyone know how I can now obtain Veeam job ids using PowerShell in Veeam 8?

Thanks.

Michael

micwv8
Novice
Posts: 9
Liked: never
Joined: Nov 13, 2014 2:51 am
Full Name: Michael Walkenhorst
Contact:

Re: Veeam Report Question

Post by micwv8 » Nov 13, 2014 10:16 am

I realized the code worked if I simply removed the GetItem()

All working now.

Thanks.

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

Re: Veeam Report Question

Post by veremin » Nov 13, 2014 12:47 pm

Even though I have no clues on what source code looks like, I still believe that Job Objects ID can be found in easier way:

Code: Select all

$jobobjids  = (Get-VBRJob -name "Name of your backup").GetObjectsInJob().id
Thanks.

Backerupper
Enthusiast
Posts: 47
Liked: 23 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: Veeam Report Question

Post by Backerupper » Jan 07, 2015 12:57 pm 1 person likes this post

fyi - the script report has been updated with a few minor tweaks for VBR v8

http://blog.smasterson.com/2014/12/18/m ... 8-support/

Hope you find it useful!

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

Re: Veeam Report Question

Post by veremin » Jan 13, 2015 9:20 am

Thank you sharing the script with the community; highly appreciated. Thanks.

Shaft
Influencer
Posts: 10
Liked: never
Joined: Nov 05, 2013 3:06 pm
Full Name: Vince Rucolas
Contact:

Re: Veeam Report Question

Post by Shaft » Feb 03, 2015 1:45 pm

micwv8 Thanks for posting this I use this script often and when I found it did not work when I upgraded I not happy.

A note to v.Eremin, your suggestion did not work for me because my jobs are setup via folders and this only gives the folder names not the VMs.

Thanks again to all :mrgreen: :lol: :D

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

Re: Veeam Report Question

Post by veremin » Feb 03, 2015 2:07 pm

My script was about outputting objects IDs, not names. So, I'm not sure what names you're talking about. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests