When you have multiple jobs with many VMs it’s a boring task to change all the disk exclusions by hand. That’s why VEEAM have made a nice PowerShell module to automate this boring tasks.
Excluded disks are displayed with numbers, the numbers in Hyper-V are different (because of the IDE disks) then how the numbers are showed in VMWare.
Since Veeam 9.5 Update 4 the diskfilter mechanism in Veeam is changed.
Now we can report both.. SCSI Controller id and the Keynumber as we known earlier.
This means the PowerShell CMDLets also Changed.
Report diskfilter:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#Load VEEAM PowerShell Module Add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue #Get all VEEAM Diskfilter data $jobs = get-vbrjob $data = @() foreach ($job in $jobs) { $data += $job | Get-VBRJobObject | select name, @{label="Diskfilter";expression={$_.diskfilter.disks}} } #Export to CSV $data | export-csv C:\DiskExclusion.csv |
Change diskfilter:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
Add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue $job = get-vbrjob -Name "TST" $jobobjects = $job.GetObjectsInJob() Foreach($jobobject in $jobobjects){ $DiskArray = @() $DKeys = "2000","2001","3000","3001" foreach($Dkey in $Dkeys){ $VDiskKey = [Veeam.Backup.Model.VDiskKey]::New($DKey) $DiskArray += [Veeam.Backup.Model.CDiskKeyInfo]::CreateDiskInfo($VDiskKey) } $CDiskFilterInfo = [Veeam.Backup.Model.CDiskFilterInfo]::CreateSelectedDisks($DiskArray) $VSSOptions = $jobobject.vssoptions $JobInfoType = $jobobject.info.Type $jobobject.Update($VSSOptions,$CDiskFilterInfo,$true,$JobInfoType) } |
Change diskfilter before 9.5 Update 4
See the current excluded disks and the numbers with this script (Run as Administrator):
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#Load VEEAM PowerShell Module Add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue #Get all VEEAM Diskfilter data $jobs = get-vbrjob $data = @() foreach ($job in $jobs) { $data += $job | Get-VBRJobObject | select name, diskfilter } #Export to CSV $data | export-csv C:\DiskExclusion.csv |
Change the disks exclusions with PowerShell (Run as Administrator):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#Load VEEAM Powershell module Add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue #Get all objects in VEEAM Back-up job $objects = Get-VBRJob -name "TEST" | Get-VBRJobObject #$a is the default parameter #$b are the SCSI IDs in number format $a = "Verb8|" $b = "2000;2001;2002;2003" $disks = $a + $b #Change the disk exclusion for each object in the job Foreach($o in $objects){ $objInfo = $o.info $objInfo.diskFilter = $disks [Veeam.Backup.Core.CObjectInJob]::Update($objInfo) $locatie = $o.Name Write-host "Back-up diskconfig changed on VM: $locatie" } |
Comments are welcome.
Comments ( 3 )
Nice scripts. You also have a script to see the current excluded disks on all VM's and export to .csv for 9.5 Update 4 and higher? When I run the pre 9.5u4 script I get this as .csv output: #TYPE Selected.Veeam.Backup.Core.CObjectInJob Name,"DiskFilter" SRV0032,"Veeam.Backup.Core.CDiskFilter" SRV0050,"Veeam.Backup.Core.CDiskFilter" SRV0056,"Veeam.Backup.Core.CDiskFilter" SRV0117,"Veeam.Backup.Core.CDiskFilter" SRV0120,"Veeam.Backup.Core.CDiskFilter" Thx in advance, Ali
Hello Ali, You need to expand the diskfilter object. A way to do this is with a expression like: select name, @{label="Diskfilter";expression={$_.diskfilter.disks}} So you can go deeper in the object this way: $_.diskfilter.disks.keys Hope this helped.
Updated the code :)