I try to automate backup job creation for "NetApp SnapShot" only (no repository local veeam)
Here is the code
Code: Select all
$datastores="NFS018_XXX"
foreach ($datastore in $datastores) {
write-host ====================================== $datastore ================================== -foreground white -background red
$job_name=$datastore+"_snapnetapp_nosnapvm"
$crm = Find-VBRViEntity -DatastoresAndVMs -Name $datastore | Where-Object {$_.Path -like 'vcentername*'}
$repository = Get-VBRBackupRepository -Name "NetApp SnapShot"
Add-VBRViBackupJob -Name $job_name -Entity $crm -BackupRepository $repository -Description "$datastore snap netapp - no snap VM (pour les maintenances monthly)"
$Job = Get-VBRJob -Name $job_name
$JobOptions = Get-VBRJobOptions $Job
$JobOptions.SanIntegrationOptions.SanSnapshotSourceEnabled = $true
##on en garde que 3 car ces backups sont utilsés pour les maintenances mensuelles
$JobOptions.SanIntegrationOptions.SanSnapshotSourceRetention = 3
$Job | Set-VBRJobOptions -Options $JobOptions
Set-VBRJobVssOptions -Job $job_name -Credentials (Get-VBRCredentials -Name "DOMAIN\user")
}
Code: Select all
4/13/2017 10:22:50 AM :: Error: Failed to call RPC function 'FcCreateDir': Invalid folder path: [NetApp Storage]. Cannot create folder. Folder path: [NetApp Storage]. Cannot create folder. Folder path: [NetApp Storage\XXXXXX_snapnetapp_nosnapvm].
- Job created manually, TargetType is "SanSnapshot"
- Job created with powershell, TargetType is "Other"
Code: Select all
(...)
JobType : Backup
SourceType : VDDK
JobTargetType : Backup
TargetType : Other <<---------- this property
TypeToString : VMware Backup
Description : xxxxx
Name : xxxxxx
BackupPlatform : EVmware
TargetHostId : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir : NetApp Storage
TargetFile : xxxxxxx
Options : Veeam.Backup.Model.CJobOptions
(...)
Code: Select all
Add-PSSnapin VeeamPSSnapIn
$Job = Get-VBRJob -Name JOB_NAME
$job.TargetType = "SanSnapshot"
'TargetType' is a ReadOnly property.
At C:\Users\sa_rousse0m\Desktop\Untitled1.ps1:4 char:1
(....)
Thank you
Marc