In this post I will share some Powershell code to enable or disable the feature BitLooker for your Veeam jobs. Since Bitlooker is a “new” feature you have to enable it on your jobs that are created before you installed Veeam v9 or higher. I my case we are running Veeam Backup for quite some years now, so we had to enable this feature on hundreds of jobs. Once again Powershell to the rescue.
Bur first things first, what is Bitlooker?
With this option enabled, Veeam Backup & Replication performs the following operations during the job session:
- Veeam Backup & Replication accesses the MFT file on the VM guest OS to identify deleted file blocks, and zeros out these blocks.
- Veeam Backup & Replication processes and transports data blocks of the VM image in the following manner:
- If a data block of the VM image contains only the deleted file blocks, Veeam Backup & Replication does not read this data block from the source datastore.
- If a data block of the VM image contains zeroed out blocks and other data, Veeam Backup & Replication copies this block to the target. Due to data compression, data blocks that are marked as deleted are compressed, and the size of the resulting backup or replica file reduces.
source: https://helpcenter.veeam.com/docs/backup/vsphere/dirty_blocks.html?ver=95
You can find the Exclude delete file blocks option in the job configuration wizard under Storage – Advanced – Storage. This option is enabled by default if you configured the job after you installed Veeam v9 but is disabled on jobs created before the installation or upgrade to Veeam v9. See the screenshot below:

Well that’s great this new option but I need to configure this setting for hundreds or maybe even more jobs. Is this possible via Powershell? On the Veeam forum you can find a sample script written by v.Eremin. This script will enable this setting right away with no interaction to the user. I wanted to create a script so I was able to see which jobs needs to be configured. So I came up with the following script:
Add-PSSnapin VeeamPSSnapIn
Connect-VBRServer -Server VEEAM-SRV01.DOMAIN.LOCAL
$BitlookerInfo = @()
$AllVbrJobs = Get-VBRJob
$AllVbrJobsCount = ($AllVbrJobs | Measure).Count
$VeeamBackupServer = (Get-VBRLocalhost | Select -ExpandProperty Name).ToUpper()
Write-Output "Checking Veeam Server: $($VeeamBackupServer) ..."
Write-Output ''
$AllVbrJobsDirtyBlocksNullingDisabled = $AllVbrJobs | ?{$_.Options.ViSourceOptions.DirtyBlocksNullingEnabled -eq $False}
$AllVbrJobsDirtyBlocksNullingDisabled | %{
$BitlookerInfo += New-Object PSCustomObject -Property @{
BackupServer = $VeeamBackupServer
Name = $_.Name
ExcludeDeletedFileBlocks = $_.Options.ViSourceOptions.DirtyBlocksNullingEnabled
}
foreach($job in $BitlookerInfo){
$vbrjob = Get-VBRJob -Name $job.Name
Write-Output "Job: $($vbrjob.Name)"
$options = $vbrjob.GetOptions()
$options.ViSourceOptions.DirtyBlocksNullingEnabled = $true
$vbrjob.SetOptions($options)
}
}
$AllBitlookerDisabledJobsCount = ($BitlookerInfo | Measure).Count
Write-Output "Total Veeam jobs: $($AllVbrJobsCount)"
Write-Output "Total Veeam jobs where Bitlooker is enabled: $($AllBitlookerDisabledJobsCount)"
Write-Output ''
$BitlookerInfo | Sort Name | ft -AutoSize
Disconnect-VBRServer
This is the output of the script:
Checking Veeam Server: VEEAM-SRV01.DOMAIN.LOCAL …
Total Veeam jobs: 2
Total Veeam jobs where Bitlooker is enabled: 1
Name BackupServer ExcludeDeletedFileBlocks
—- ———— ————————
Demo-Job-01 VEEAM-SRV01.DOMAIN.LOCAL False
You can add a for each loop to loop through the Veeam Backup & Replication servers you configured. This will look like this:
Add-PSSnapin VeeamPSSnapIn
$AllVeeamServers = @("VEEAM-SRV01.DOMAIN.LOCAL","VEEAM-SRV02.DOMAIN.LOCAL","VEEAM-SRV03.DOMAIN.LOCAL","VEEAM-SRV04.DOMAIN.LOCAL")
foreach($VeeamServer in $AllVeeamServers){
Connect-VBRServer -Server $VeeamServer
$BitlookerInfo = @()
$AllVbrJobs = Get-VBRJob
$AllVbrJobsCount = ($AllVbrJobs | Measure).Count
$VeeamBackupServer = (Get-VBRLocalhost | Select -ExpandProperty Name).ToUpper()
Write-Output "Checking Veeam Server: $($VeeamBackupServer) ..."
Write-Output ''
$AllVbrJobsDirtyBlocksNullingDisabled = $AllVbrJobs | ?{$_.Options.ViSourceOptions.DirtyBlocksNullingEnabled -eq $False}
$AllVbrJobsDirtyBlocksNullingDisabled | %{
$BitlookerInfo += New-Object PSCustomObject -Property @{
BackupServer = $VeeamBackupServer
Name = $_.Name
ExcludeDeletedFileBlocks = $_.Options.ViSourceOptions.DirtyBlocksNullingEnabled
}
foreach($job in $BitlookerInfo){
$vbrjob = Get-VBRJob -Name $job.Name
Write-Output "Job: $($vbrjob.Name)"
$options = $vbrjob.GetOptions()
$options.ViSourceOptions.DirtyBlocksNullingEnabled = $true
$vbrjob.SetOptions($options)
}
}
$AllBitlookerDisabledJobsCount = ($BitlookerInfo | Measure).Count
Write-Output "Total Veeam jobs: $($AllVbrJobsCount)"
Write-Output "Total Veeam jobs where Bitlooker is enabled: $($AllBitlookerDisabledJobsCount)"
Write-Output ''
$BitlookerInfo | Sort Name | ft -AutoSize
Disconnect-VBRServer
}