PowerShell script exchange
Post Reply
masonit
Service Provider
Posts: 181
Liked: 12 times
Joined: Oct 09, 2012 2:30 pm
Full Name: Magnus
Contact:

Add-VBRViJobObject, Remove-VBRJobObject error handling

Post by masonit » Jan 14, 2019 3:42 pm

Hi

When using Add-VBRViJobObject and I add a vm to a job. Information is returned about the added vm. But If I try to add same vm again nothing happens. Shouldn't I get an error saying like "vm already in job".

Same thing with Remove-VBRJobObject. If I try to remove a object that is already removed. No errors is reported. Nothing like "vm not present in job".

Shouldn't there by any error handling?

\Masonit

v.Eremin
Veeam Software
Posts: 15542
Liked: 1183 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBRViJobObject, Remove-VBRJobObject error handling

Post by v.Eremin » Jan 14, 2019 5:41 pm

Currently, those warnings do not exist in PowerShell.

If you want to handle this situation somehow, you will need to automatically check whether any information is returned regarding VM added; if not, it will mean that VM has been already added to the selected job.

Thanks!

masonit
Service Provider
Posts: 181
Liked: 12 times
Joined: Oct 09, 2012 2:30 pm
Full Name: Magnus
Contact:

Re: Add-VBRViJobObject, Remove-VBRJobObject error handling

Post by masonit » Jan 15, 2019 10:23 am

Ok. Information is only returned from Add-VBRViJobObject, not from Remove-VBRJobObject. But I could always check the job objects again to verify that vm is either added or removed.

\Masonit

v.Eremin
Veeam Software
Posts: 15542
Liked: 1183 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBRViJobObject, Remove-VBRJobObject error handling

Post by v.Eremin » Jan 16, 2019 4:54 pm

Correct, checking the number of objects afterwards sounds also like a good idea. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests