PowerShell script exchange
Post Reply
pizzim13
Enthusiast
Posts: 94
Liked: 6 times
Joined: Apr 21, 2011 7:37 pm
Contact:

Change job description field via powershell

Post by pizzim13 »

Is it possible to change the description field of a job via powershell. Currently, I see it as read only.

Code: Select all

PS C:\> $(Get-VBRJob)[0].description = "test"
"Description" is a ReadOnly property.
At line:1 char:18
+ $(Get-VBRJob)[0]. <<<< description = "test"
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

Sethbartlett
Expert
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: Change job description field via powershell

Post by Sethbartlett »

I am currently looking into a way to see if this is doable or how we can get this done for you.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.

Sethbartlett
Expert
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: Change job description field via powershell

Post by Sethbartlett »

The way to do this is a little odd...but what you can do is the following:

Code: Select all

$job = Get-VBRJob | ?{$_.name -eq "JobName"}
$job.info.Update("jobname", "description")
[Veeam.Backup.Core.CBackupJob]::Update($job.info)
$Job.Info.Update requires 2 arguments, the jobname and the description. This will allow you to set the job description and change the job name of your job.

This means if you want to just change the description, that line would be

Code: Select all

$job.info.update($job.Name, "Description text")
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.

Gostev
SVP, Product Management
Posts: 26497
Liked: 4149 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Change job description field via powershell

Post by Gostev »

What a dirty hack Seth ;) this is not really a supported way, for example changing the job name this way can screw up a lot of things.
Right now there is no supported way to set description through API (use the above at your own risk), but I've asked to add this to v6.

Sethbartlett
Expert
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: Change job description field via powershell

Post by Sethbartlett »

Completely agreed, I would never use this to change the name of a job :) Powershell is a little too powerful and lets you have duplicates names with your jobs, which is a no no :)
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.

Andreas Neufert
VP, Product Management
Posts: 4361
Liked: 815 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Change job description field via powershell

Post by Andreas Neufert »

@Gostev Hi Anton, I can´t find it in v6. Do you have an idea where to find this? Need this for a customer. Thanks in advance ... CU Andy

chrmol
Enthusiast
Posts: 36
Liked: 2 times
Joined: May 17, 2010 7:41 pm
Full Name: Christian Moeller
Location: Denmark
Contact:

Re: Change job description field via powershell

Post by chrmol »

Is it possible to change the content of "description" field in powershell with Veeam 6.5 (in a supported way :D ) ?

reaperhammer
Service Provider
Posts: 27
Liked: 8 times
Joined: Aug 18, 2016 7:59 pm
Full Name: Will S
Contact:

Re: Change job description field via powershell

Post by reaperhammer »

Veeam Logoby Andreas Neufert » Sun Apr 15, 2012 8:21 pm
@Gostev Hi Anton, I can´t find it in v6. Do you have an idea where to find this? Need this for a customer. Thanks in advance ... CU Andy
Any update on this feature?

fdecome
Service Provider
Posts: 8
Liked: never
Joined: Oct 13, 2017 1:58 pm
Full Name: DECOME Fabrice
Contact:

Re: Change job description field via powershell

Post by fdecome »

Hello,
Any update for this features ?
Regard's

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

Re: Change job description field via powershell

Post by veremin »

You can change a job name, using the following script.

Code: Select all

$Job = Get-VBRJob "Name of your Job"
$Job.Info.CommonInfo.Name = "New Name"
$Job.Update()
However, we haven't found an easy way to change a job description:

Thanks.

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

Re: Change job description field via powershell

Post by Vek17 »

I have come up with a way to modify description but I haven't done a full look to see if there are any unwanted side effects/issues. Any gotchas I should be on the lookout for?

Code: Select all

$updatedInfo = [Veeam.Backup.Model.CDbBackupJobInfo]::CreateNew(
    $Job.Info.ID, 
    [Veeam.Backup.Model.CDbJobCommonInfo]::new($Job.Info.CommonInfo.Name,"NEW DESCRIPTION HERE",$Job.Info.CommonInfo.ModifiedBy), 
    $Job.Info.jobType, 
    $Job.Info.targetHostId, 
    $Job.Info.targetDir, 
    $Job.Info.targetFile, 
    $Job.Info.options, 
    $Job.Info.ScheduleOptions, 
    $Job.Info.vssOptions, 
    $Job.Info.vcbHostId, 
    $Job.Info.SourceType, 
    $Job.Info.targetType, 
    $Job.Info.includedSize, 
    $Job.Info.excludedSize, 
    $Job.Info.BackupPlatform, 
    $Job.Info.targetRepositoryId, 
    $Job.Info.InitialRepositoryId, 
    $Job.Info.parentScheduleId, 
    $Job.Info.pwdKeyId, 
    $Job.Info.BackupPolicyTag, 
    $Job.Info.sqlEnabled, 
    $Job.Info.oracleEnabled
)
[Veeam.Backup.Core.CBackupJob]::Update($updatedInfo)

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

Re: Change job description field via powershell

Post by veremin »

Nothing from the top of my head. However, if I were you, I would:

- clone existing job
- change description on it, using the script provided
- execute the job once or twice
- check whether everything works as expected
- and based on results, stick to the script for the original job

Might be an overkill, but it's better to be on the safe side.

Thanks!

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

Re: Change job description field via powershell

Post by masonit »

Hi

Any supported way now?

\Masonit

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

Re: Change job description field via powershell

Post by veremin »

Nothing has changed for this matter since my last reply. Thanks!

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

Re: Change job description field via powershell

Post by masonit »

Ok, not good to not be able to set description in a supported way with ps. Should I create a change request for this?

\Maso

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

Re: Change job description field via powershell

Post by veremin » 1 person likes this post

Posting here is enough, we will keep an eye on this request, while planing PowerShell enhancements in future product versions. Thanks!

jjlethiers
Service Provider
Posts: 13
Liked: 1 time
Joined: Apr 11, 2016 9:55 am
Full Name: Jean-Jacques Lethiers
Contact:

Re: Change job description field via powershell

Post by jjlethiers »

One more vote!

oleg.feoktistov
Veeam Software
Posts: 444
Liked: 137 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Change job description field via powershell

Post by oleg.feoktistov »

Thanks, @jjlethiers. Noted your vote.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests