I need a duplicate of a job with ALL it's specific settings and I want this duplicate to get a specific name. This could possible be done in a few ways:
#1 copy-vbrjob and with some parameter set the new name
#2 copy-vbrjob and rename the _clone1 job afterwards
#3 create a new job with the name I want and somehow duplicate all the settings of one job to the new job.
#4 ?
#1 and #2 do not seem possible, so perhaps the way to go is #3. How would I do this exactly?
Any help would be much appreciated.
Regards,
Alex
-
- Service Provider
- Posts: 105
- Liked: 7 times
- Joined: Aug 24, 2010 8:55 am
- Full Name: Alex
- Contact:
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: clone job or create new and copy settings
Just a quick question - what product version are you currently at? v7 or v8? Thanks.
-
- Service Provider
- Posts: 105
- Liked: 7 times
- Joined: Aug 24, 2010 8:55 am
- Full Name: Alex
- Contact:
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: clone job or create new and copy settings
Ok, then, option 3 seems to be the way to go. What particular setting you're willing to copy? Just general job settings, such as repository, retention, etc.? Or settings such as source objects to backup, application aware VM specific logic and so, should be copied, as well?
-
- Service Provider
- Posts: 326
- Liked: 78 times
- Joined: Mar 16, 2015 4:00 pm
- Full Name: David Rubin
- Contact:
Re: clone job or create new and copy settings
I've written a "down-and-dirty" script that I use to clone jobs to a new datastore. It looks at all the jobs on an existing datastore, disables them, renames them, then creates a clone of each with the original name but pointing at the new datastore. It does not move the data (although that shouldn't be difficult to add in, if desired). Note that the "$NewName" variable determines the new name for the original job; the way this script is written, it actually renames the old job and creates the new job with the original name, but it doesn't have to be that way:
Code: Select all
Add-PSSnapin VeeamPSSnapin
$Jobs = Get-VBRJob
$OldRepo = 'OLD REPOSITORY' # The repository that will be replaced
$NewRepo = 'NEW REPOSITORY' # The new repository for the cloned jobs
Foreach($Job in $Jobs)
{
$RepoTarget = $Job.FindTargetRepository() # Scan all jobs on the server and check each one to see if it's on the old repo
If ($RepoTarget.Name -eq $OldRepo)
{
$Job.Name
$OldName = $Job.info.CommonInfo.Name
$NewName = $OldName + ' (old)' # Append to the end of the original job
$Test = Get-VBRJob -Name $NewName # Check to see if a job already exists with the proposed new name
If ($Test.Name -ne $null)
{
Write-Host "Job already exists!"
} else {
$Job.info.CommonInfo.Name = $NewName
$Job.Update() # Commit the change
Copy-VBRJob $Job -Name $OldName -Repository $NewRepo # Clone the job with the original name and the new repo
Disable-VBRJob -Job $Job # Disable the original job
$ClonedJob = Get-VBRJob -Name $OldName
Enable-VBRJob -Job $ClonedJob # Enable the cloned job
}
}
}
Who is online
Users browsing this forum: No registered users and 11 guests