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

PowerShell script exchange

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

Veeam Logoby lightsout » Fri Jan 30, 2015 4:41 pm

Hey All,

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

http://helpcenter.veeam.com/backup/80/powershell/set-vbrjobadvancedvioptions.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!
lightsout
Expert
 
Posts: 189
Liked: 50 times
Joined: Thu Apr 10, 2014 4:13 pm

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

Veeam Logoby v.Eremin » Mon Feb 02, 2015 10:49 am 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.
v.Eremin
Veeam Software
 
Posts: 14019
Liked: 1051 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

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

Veeam Logoby lightsout » Mon Feb 02, 2015 10:26 pm

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. :)
lightsout
Expert
 
Posts: 189
Liked: 50 times
Joined: Thu Apr 10, 2014 4:13 pm

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

Veeam Logoby v.Eremin » Tue Feb 03, 2015 9:31 am

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.
v.Eremin
Veeam Software
 
Posts: 14019
Liked: 1051 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

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

Veeam Logoby A1ex » Wed Aug 30, 2017 11:52 am 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.
A1ex
Lurker
 
Posts: 1
Liked: 1 time
Joined: Wed Oct 03, 2012 4:57 am
Location: Russia, Moscow
Full Name: Alexandr

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

Veeam Logoby tdewin » Wed Aug 30, 2017 1:09 pm

tdewin
Veeam Software
 
Posts: 1185
Liked: 406 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest