PowerShell script exchange
Post Reply
lightsout
Expert
Posts: 227
Liked: 62 times
Joined: Apr 10, 2014 4:13 pm
Contact:

Powershell to set "Append to the existing attribute's value"

Post by lightsout »

Hey All,

So using Set-VBRJobAdvancedViOptions I can set which attribute to send Veeam's info to:

http://helpcenter.veeam.com/backup/80/p ... tions.html

Using the -VmAttributeName & -SetResultsToVmAttribute. So the "Append to the existing attribute's value" is a new feature of v8 and I want to turn it off, as all my jobs have it on by default.

Does anyone know how to change it? I don't see a way using Set-VBRJobAdvancedViOptions.

Thanks!
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell to set "Append to the existing attribute's va

Post by veremin » 1 person likes this post

You can disable that option, using the script provided below:

Code: Select all

$Job = Get-VBRJob -name "Name of your backup Job"
$Options = $Job.Getoptions()
$Options.ViSourceOptions.VmNotesAppend = $False
$Job.SetOptions($Options)
Thanks.
lightsout
Expert
Posts: 227
Liked: 62 times
Joined: Apr 10, 2014 4:13 pm
Contact:

Re: Powershell to set "Append to the existing attribute's va

Post by lightsout »

That did it, thanks a lot!

Just some feedback, I do find it hard to browse the Powershell reference library to find what I want. So a "dummy's guide" for how to change each switch in PowerShell would be kinda cool. :)
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell to set "Append to the existing attribute's va

Post by veremin »

There are numerous properties and methods existing inside our PS objects. So, it would be rather hard to enumerate them all. What I typically recommend is to assign this or that particular object to a variable, and use Get-Member commandlet to discover available properties.

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Job | Get-Member
Thanks.
A1ex
Novice
Posts: 8
Liked: 3 times
Joined: Oct 03, 2012 4:57 am
Full Name: Alexandr Varlamov
Location: Russia, Moscow
Contact:

Re: Powershell to set "Append to the existing attribute's va

Post by A1ex » 1 person likes this post

Hi All.

Convenient way to explore job options is type "$job.Options." and press Tab button

For example output of $job.Options.ViSourceOptions command

Code: Select all

EncryptLanTraffic         : False
FailoverToNetworkMode     : False
VCBMode                   : san
VDDKMode                  : san;nbd
UseChangeTracking         : True
EnableChangeTracking      : True
VMToolsQuiesce            : False
VmAttributeName           : Notes
BackupTemplates           : True
ExcludeSwapFile           : True
DirtyBlocksNullingEnabled : True
BackupTemplatesOnce       : True
SetResultsToVmNotes       : False
VmNotesAppend             : True
After you'll know options you need, you could modify several backup jobs, one by one:

Code: Select all

#add veeam pssnapin if needed
if (Get-PSSnapin | findstr 'VeeamPSSnapin') {Write-Host 'ok'} else {Add-PSSnapin VeeamPSSnapin}

# set backup jobs list
$jobs = Get-VBRJob -Name '*test*'

# for each job do needed things
foreach ($job in $jobs)
{
$Options = $Job.Getoptions()
$Options.ViSourceOptions.VmNotesAppend = $false
$Options.ViSourceOptions.VmAttributeName = 'veeam'
$Options.ViSourceOptions.SetResultsToVmNotes = $true
$Job.SetOptions($Options)
}
Hope it helps.
tdewin
Veeam Software
Posts: 1818
Liked: 655 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Powershell to set "Append to the existing attribute's va

Post by tdewin »

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests