Rename backup job

PowerShell script exchange

Rename backup job

Veeam Logoby aborigin » Fri May 25, 2012 5:04 pm

Hello!

I have around 70 backup jobs and I need to rename them by job purpose.

I'm searching for a command that can do that.

Example:

now: job1, job2, job3, job4

after renaming: test_job1, internal_job2, internal_job3, _develop_job4

Thanks,
Simon
aborigin
Novice
 
Posts: 5
Liked: never
Joined: Fri May 25, 2012 8:33 am
Full Name: Simon Tomazic

Re: Rename backup job

Veeam Logoby Sethbartlett » Tue May 29, 2012 1:01 pm

There is nothing actually supported for renaming the jobs. I could give you some code that will work but it's not pretty whatsoever.
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: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Rename backup job

Veeam Logoby aborigin » Tue May 29, 2012 2:52 pm

Every solution that is not clickable would be helpful.

Thanks for help,
Simon
aborigin
Novice
 
Posts: 5
Liked: never
Joined: Fri May 25, 2012 8:33 am
Full Name: Simon Tomazic

Re: Rename backup job

Veeam Logoby Sethbartlett » Tue May 29, 2012 3:12 pm

Well, I have a semi-easy solution for you. I was working on a new powershell module and it's VERY very alpha but will do what you need :)

http://vpowermodule.googlecode.com/file ... Module.dll

Download this file and place it in your Backup and Replication folder(C:\program files\Veeam\Backup and Replication) and then open up powershell and do:

Code: Select all
Import-Module C:\program Files\Veeam\Backup And Replication\vPowerModule.dll


From here, you can use the following commands to do as you need:

Code: Select all
Get-VPMJob

$Job = Get-VPMJob -name "Name of Job"
$Job.Name = "New Name"
$Job.Save()


The reason I am handing you this DLL is because I already wrote the checking so you cannot accidentally duplicate job names. If I gave you the raw .NET code, you could accidentally rename a bunch of jobs with the same name and that would be a nightmare :wink:

If you run into any problems, let me know on here or @vPowerModule on twitter.
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: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Rename backup job

Veeam Logoby aborigin » Wed May 30, 2012 7:50 am

I face problem right on beginning :)

Code: Select all
PS > import-module "C:\Program Files\Veeam\Backup and Replication\vPowerModule.dll"
Import-Module : Could not load file or assembly 'Lapointe.PowerShell.MamlGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=313d176eae804710
' or one of its dependencies. The system cannot find the file specified.
At line:1 char:14
+ import-module <<<<  "C:\Program Files\Veeam\Backup and Replication\vPowerModule.dll"
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
aborigin
Novice
 
Posts: 5
Liked: never
Joined: Fri May 25, 2012 8:33 am
Full Name: Simon Tomazic

Re: Rename backup job

Veeam Logoby Sethbartlett » Wed May 30, 2012 1:14 pm 1 person likes this post

My apologies, like I said, very alpha.

Here is the new link:
http://vpowermodule.googlecode.com/file ... Module.dll

This time it should work fine :) Had to comment out some XML documentation stuff.
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: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Rename backup job

Veeam Logoby aborigin » Thu May 31, 2012 11:32 am

It works perfectly for me :)

Code: Select all
import-module "C:\Program Files\Veeam\Backup and Replication\vPowerModule.dll"

Foreach ($job in (Get-VBRJob -Name * | Where-Object { $_.GetTargetRepository().name -eq 'DEVELOP' } )) {
   $jobname2rename = $job.Name
   $job2rename = Get-VPMJob -name $jobname2rename
   $job2rename.Name = "DEV_$jobname2rename"
   $job2rename.Save()
}


Thank you for all help.
aborigin
Novice
 
Posts: 5
Liked: never
Joined: Fri May 25, 2012 8:33 am
Full Name: Simon Tomazic

Re: Rename backup job

Veeam Logoby Sethbartlett » Thu May 31, 2012 1:27 pm

No problem at all :)
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: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Rename backup job

Veeam Logoby foggymtn » Tue Nov 20, 2012 3:58 pm

I'm looking to do the same thing. Is there an updated version of the dll for 6.5?

Thanks!
foggymtn
Lurker
 
Posts: 2
Liked: never
Joined: Tue Nov 20, 2012 3:54 pm
Full Name: Rob

Re: Rename backup job

Veeam Logoby Vitaliy S. » Tue Nov 20, 2012 6:33 pm

This dll is not officially supported, so I do not believe there is any update to this.
Vitaliy S.
Veeam Software
 
Posts: 19954
Liked: 1144 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Rename backup job

Veeam Logoby foggymtn » Tue Nov 20, 2012 7:16 pm

Sounds good. Thank you for the reply
foggymtn
Lurker
 
Posts: 2
Liked: never
Joined: Tue Nov 20, 2012 3:54 pm
Full Name: Rob

[MERGED] : Rename Job Powershell Veeam 6.5

Veeam Logoby sidavid » Sat Jun 15, 2013 2:56 am

Hi,
I want to rename job name. I started the script below but it does not work:

Code: Select all
foreach ($Job in Get-VBRJob){
$JobN = $Job.Name
$d= $JobN.substring(0,4)
$n = $JobN.substring(6)
if($JobN.StartsWith("PROD1")){
$JobNew = "JOB1-"+$d+"-DAILY1-"+$n
Write-Host $JobNew
$Job.Name = $JobNew
$Job.Save()
}
}


Many thanks
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: Rename backup job

Veeam Logoby v.Eremin » Mon Jun 17, 2013 8:39 am

You have been merged to the existing thread which is concerned with job renaming stuff.

Previously, there has been an option to utilize special .dll provided by Seth Barthlett. However, it seems that this .dll has been written to 6.0 version and can’t be used today.

So, as mentioned above, there is still no supported way how you can rename your job via PS.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13708
Liked: 1024 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] : Rename Backup Job

Veeam Logoby Nettkroken » Wed Oct 23, 2013 8:48 am

How do i Rename a Backup job with Powershell, is it possible?
Nettkroken
Service Provider
 
Posts: 5
Liked: never
Joined: Wed Oct 23, 2013 8:44 am
Full Name: Nettkroken AS

Re: Rename backup job

Veeam Logoby v.Eremin » Wed Oct 23, 2013 11:05 am

Quick tests suggest that there is still no way how backup job can be renamed via PS. Though, thanks for the heads-up; highly appreciated.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13708
Liked: 1024 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest