PowerShell script exchange
Post Reply
karim
Enthusiast
Posts: 51
Liked: 5 times
Joined: Oct 17, 2018 9:01 am
Contact:

job name not updated

Post by karim »

hello,
i've renamed a backup copy job and i noticed that the ps snappin does not find the job with his new name
i know that veeam does not really rename jobs but is there something to do for updating this ?
(i'm using vb&r 9.5.42866)
thank you
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: job name not updated

Post by veremin »

Have you re-opened a PS console (just in case)? What script do you use to find a backup copy job? Thanks!
karim
Enthusiast
Posts: 51
Liked: 5 times
Joined: Oct 17, 2018 9:01 am
Contact:

Re: job name not updated

Post by karim »

hello,
yes i have re-opened powershell
i tried directly from the vbr server and remotly from my computer (where the console is installed).

here is the simple code :

Code: Select all

Add-Pssnapin VeeamPssnapin
$JOBNAME = "c_mess_45j"
$restorepoint = Get-VBRBackup -Name $JOBNAME | Get-VBRRestorePoint -Name vm71
with this job name the result is empty, if i try with the old name i can get all the restorepoints

here is the job properties where i can find the old name :

Code: Select all

JobName                          : c_mess_30j 
Name                             : c_mess_30j 
Path                             : c_mess_30j 
DirPath                          : c_mess_30j 
PartialPath                      : c_mess_30j  
Name                     : c_mess_30j.vbm
thank you
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: job name not updated

Post by veremin »

You're querying previously created restore points, not backup copy jobs. So, the behaviour is expected - previously created restore points have previous backup copy job name. Thanks!
Vek17
Service Provider
Posts: 49
Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:

Re: job name not updated

Post by Vek17 »

You're querying previously created restore points, not backup copy jobs. So, the behaviour is expected - previously created restore points have previous backup copy job name. Thanks!
I want to say that the restore point is not being queried here but the backup which does not have a need or expectation of keeping a historic name as far as I am aware. Restore points are not aware of job names at all and simply pull this information from the backup itself. This job name is also pretty easy to change either through the UI by remapping the backup to to job which updates the job or through power shell to force an update and accomplish the same thing.

Code: Select all

$Backup = (Get-VBRBackup | Where-Object {$_.ID -eq 'B5F074C4-1598-4C1B-ADDF-2B021B12E95A'})
$Backup.Update($Backup.GetJob())
In either case I'd call this poor naming of the field at best or unexpected behavior at worst since the job_name would reasonably be expected to reflect the current job name, or in the case of an unmapped backup the job_name of the last thing it was assigned of.

That being said the easiest workaround to query by job name now is to actually query for the job and then get the backup from the job instead of just asking for the backup but that is not something that is clear by documentation

Code: Select all

(Get-VBRJob -Name 'Example Backup Name').FindLastBackup()
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: job name not updated

Post by veremin »

Get-VBRRestorePoint cmdlet is used, so, it's restore points that are being queried.

Code: Select all

$restorepoint = Get-VBRBackup -Name $JOBNAME | Get-VBRRestorePoint -Name vm71
Also, I'd advice against using undocumented PS method (like loading an assembly) especially to perform actions product is not ready for.

Be aware that ifsomething goes unexpectedly after the backup job name is updated on previous backups, you will be left with unsupported product configuration.

Thanks!
Vek17
Service Provider
Posts: 49
Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:

Re: job name not updated

Post by Vek17 »

Get-VBRRestorePoint cmdlet is used, so, it's restore points that are being queried.
While he is calling that commandlet it is not the part that is failing. This issue is this does not return any result:

Code: Select all

Get-VBRBackup -Name $JOBNAME
Since that is failing of course no restore points will return because he is essentially just running this:

Code: Select all

@() | Get-VBRRestorePoint
The workaround is to query through the job directly which is not intuitive and feels like not how this is designed to work.

Option 1 Technically unsupported

Code: Select all

(Get-VBRJob -Name $JOBNAME).FindLastBackup() | Get-VBRRestorePoint
Option 2 Technically supported but slow

Code: Select all

Get-VBRBackup | Where-Object {$_.jobID -eq (Get-VBRJob -Name $JOBNAME).ID} | Get-VBRRestorePoint
Regardless of the ability to work around this I firmly believe that the job_name of the backup should update when the name of the job is changed. It is possible to do this though supported means by simply remapping the backup to the job. Really strange for the job_name of a backup to not match the name of the job it is pointing to.

EDIT: I attribute the issue to simply an oversight in the job rename process to be clear not a bug in how powershell is working.
karim
Enthusiast
Posts: 51
Liked: 5 times
Joined: Oct 17, 2018 9:01 am
Contact:

Re: job name not updated

Post by karim »

thank you it's better with a remapping.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests