The jobs are created, but when run there are no storage snapshots created. If I edit a job in the GUI it will start working, even though I have not edited any settings.
The code used to create a job is something like this:
Code: Select all
$SnapRepo = Get-VBRBackupRepository -Name "HPE 3PAR Snapshot"
$vCluster = Find-VBRViEntity -Name "cluster1"
$DatastoreClusters = Find-VBRViDatastoreCluster -Server $vCluster
foreach ($DatastoreCluster in $DatastoreClusters) {
$SnapJob = Add-VBRViBackupJob -Entity $DatastoreCluster -Name "Snap Job" -BackupRepository $SnapRepo
$SnapJob | Set-VBRJobSchedule -Daily -At "10:00" -DailyKind Everyday
$SnapJob | Set-VBRJobAdvancedViOptions -VmAttributeName "Notes" -SetResultsToVmAttribute $true -VMToolsQuiesce $true
$SnapJob | Set-VBRJobAdvancedNotificationOptions -SnmpNotification $false -EmailNotification $true -EmailNotificationAddress "someone@corp.tld"
$SnapJobOpts = Get-VBRJobOptions -Job $SnapJob
$SnapJobOpts.BackupStorageOptions.RetainCycles = 7
$SnapJobOpts.ViSourceOptions.BackupTemplates = $false
$SnapJobOpts.ViSourceOptions.BackupTemplatesOnce = $false
$SnapJob | Set-VBRJobOptions -Options $SnapJobOpts
$SnapJob | Enable-VBRJobSchedule
}#foreach
EDIT One more thing to note:
When I compare the options (Get-VBRJobOptions) for a job created using powershell and one where I have edited it in the GUI I see some extra value son the one edited in the GUI:
Code: Select all
SanStorageRepositoryOptions : SanStorageRepositoryOptions
SourceProxyAutoDetect : True
TargetProxyAutoDetect : True
CheckRetention : True
SanSnapshotTransferEnabled : False
SanSnapshotTransferRetention : 14
SanSnapshotBackupBackupSource : False
SanSnapshotReplicaTransferEnabled : False
SanSnapshotReplicaTransferRetention : 14
SanSnapshotReplicaBackupSource : False
NibleSnapshotTransferEnabled : False
NibleSnapshotTransferRetention : 14
NibleSnapshotTransferAsBackupSource : False
HpPersistentPeerEnabled : False
HpPersistentPeerBackupSource : False
BackupIsAttached : False