Veeam: Change the Veeam Storage Optimization with Powershell
By Arne Fokkema - ICT-Freak.nl
In Veeam Backup and Replication you can choose three different types of Storage optimization.
See the blog post on the Veeam website for more info: http://www.veeam.com/blog
From @gostev I received the following tip:
Note that storage optimization will not take effect until next full backup. Setting is used for newly created backup storage only.
There is no standard cmdlet to change these settings, so we have to find the property of the Storage optimization settings. With some trial and error I found the stgBlockSize property. This property can be found inside the vbrjob options.
You can view these properties via:
$vbrjob = Get-VBRJob | where {$_.Name -eq "<vbrjobname>"}
$options = $vbrjob.GetOptions()
and via the StgBlockSize property you are able to find the actual value of this setting.
$options.StgBlockSize
I have tried the three options from the screenshot and found the following three values:
$localtarget = "KbBlockSize1024"
$lantarget = "KbBlockSize512"
$wantarget = "KbBlockSize256"
Now we have found the properties we need to change the settings via PowerShell. We can build some scripts.
If you want to change the Storage option to LAN target on all your backup jobs. You can run the following script on your Veeam Backup and Replication server. Don’t forget to change the StgBlockSize value with the variable you want to use.
if((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null){
Add-PSSnapin "VeeamPSSnapIn"
}
$vbrjobs = Get-VBRJob
foreach($vbrjob in $vbrjobs){
#Storage optimization
$localtarget = "KbBlockSize1024"
$lantarget = "KbBlockSize512"
$wantarget = "KbBlockSize256"
#Change Job Options
$options = $vbrjob.GetOptions()
$options.StgBlockSize = $lantarget
$vbrjob.SetOptions($options)
}
Or if you want to change just a couple of your jobs, you can use the following script:
if((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null){
Add-PSSnapin "VeeamPSSnapIn"
}
$vbrjobs = "<Job1>","<Job2>"
foreach($vbrjobname in $vbrjobs){
#Storage optimization
$localtarget = "KbBlockSize1024"
$lantarget = "KbBlockSize512"
$wantarget = "KbBlockSize256"
#Change Job Options
$vbrjob = Get-VBRJob | where {$_.Name -eq $vbrjobname}
$options = $vbrjob.GetOptions()
$options.StgBlockSize = $lantarget
$vbrjob.SetOptions($options)
}
So with the Powershell toolkit for Veeam you can perform every change you want and can do via the GUI. You can expect some more posts about automating Veeam Backup and Replication with Powershell.
- xtravirt's blog
- Login or register to post comments
Spotlight:
VMware Documentation Downloader v11.08.30
Updated for vSphere 5 - A free tool for those on the move who need information FAST
vSphere 5 License Entitlement Changes
See what has changed in the license entitlement in vSphere 5?
Thin Client vs Zero Client
The differences between Thin and Zero desktop clients for VDI

