PowerShell script exchange
Post Reply
half_lif3
Novice
Posts: 4
Liked: never
Joined: Mar 07, 2012 4:34 am
Contact:

replication choose a specific datastore

Post by half_lif3 »

Hi,

I'm on the midst on evaluating veeam v6 and starting to exploring the powershell feature.
While I'm having some issue on creating replication jobs via powershell.
Can anyone provide me an example on how to schedule a replication job on specific time and under specific datastore?

Code: Select all


$GSServer = Find-VBRViEntity -name vmserver
$BKServer = Get-VBRServer | where {$_.Name -eq "192.168.0.178"}
$BKDS = Find-VBRDatastore -Server ($BKServer) | where {$_.Name -eq "datastore01"}

Add-VBRViReplicaJob -Name BK_vmserver -Server ($BKServer) -Entity ($GSServer) -Datastore ($BKDS)

The error I"m getting is "Add-VBRViReplicaJob : Cannot bind parameter 'Datastore'. Cannot convert the "da
tastore01" value of type "Veeam.Backup.ViSoap.Datastore" to type "Veeam.Backup.C
ore.Infrastructure.CViDatastoreItem"."
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: replication choose a specific datastore

Post by ThomasMc »

This is what you'll be wanting :)

Code: Select all

$BKServer = Get-VBRServer -Name "192.168.0.178"
$BKDS = Find-VBRViDatastore -Server $BKServer -Name "datastore01"
half_lif3
Novice
Posts: 4
Liked: never
Joined: Mar 07, 2012 4:34 am
Contact:

Re: replication choose a specific datastore

Post by half_lif3 »

Hi, Thanks. Will work out on a script to schedule 50 jobs to backup 50 different VMs :oops:
half_lif3
Novice
Posts: 4
Liked: never
Joined: Mar 07, 2012 4:34 am
Contact:

Re: replication choose a specific datastore

Post by half_lif3 »

Refer to my below code. I've run and the options "Run the job automatically" for the job still remain un-tick.
Can i know what is the options available?

Code: Select all

$job = Get-VBRJob -name "BK_vmserver"
$schedule = $job |Get-VBRjobscheduleoptions

$schedule.OptionsDaily.Enabled = $true
$schedule.OptionsDaily.Kind = "SelectedDays"
$schedule.OptionsDaily.Days = "Monday", "Wednesday", "Friday"
$schedule.OptionsDaily.Time = "12:00:00"

Set-VBRJobScheduleOptions -Job $job -Options $schedule
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: replication choose a specific datastore

Post by ThomasMc »

is it version 5 your using?
half_lif3
Novice
Posts: 4
Liked: never
Joined: Mar 07, 2012 4:34 am
Contact:

Re: replication choose a specific datastore

Post by half_lif3 »

negative. I'm using Version 6 :S
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: replication choose a specific datastore

Post by ThomasMc »

This is what your after

Code: Select all

$job = Get-VBRJob -Name "Job Name"
$job.options.JobOptions.RunManually = $false
$job.EnableScheduler()
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests