Set VSS options for each machine in a job

PowerShell script exchange

Set VSS options for each machine in a job

Veeam Logoby mgratla » Wed Feb 25, 2015 10:29 pm

I've got a script worked out for creating jobs, but I need to set VSS options if the job contains a machine with a name that contains SQL

What I have to get the jobs into an array and parse them, is this

[code]$VSSARRAY = Get-VBRJob -Name $JobName | Get-VBRJobObject

foreach $_.name in $VSSARRAY { {if $_.Name -Like "*SQL*} {/code]

And here's where I'm stuck. Most of the commands seem to indicate that you'll set it for the entire job, but I want to set each SQL machine as "Ignore processing failures" and "do not truncate logs"

Can anyone assist?
mgratla
Influencer
 
Posts: 19
Liked: never
Joined: Tue Feb 04, 2014 11:13 pm
Full Name: Mark

Re: Set VSS options for each machine in a job

Veeam Logoby mgratla » Thu Feb 26, 2015 12:32 am

Tried the following

Code: Select all
$Vbrvssoptions = New-VBRJobVssOptions
$Vbrvssoptions.Enabled =$True
$Vbrvssoptions.IgnoreErrors =$True
$Vbrvssoptions.SqlBackupOptions.TransactionLogsProcessing = "NeverTruncate"
$vbrvssoptions.ExchangeBackupOptions.TransactionLogsProcessing = "TruncateOnlyOnSuccessJob"

$vbrnovssoptions = New-VBRJobVssOptions
$vbrnovssoptions.Enabled =$false

#$vsscredopt = Get-VBRJob -Name $jobname | Get-VBRJobVSSOptions
#$vsscredopt.WinCredsId = MYGUID

$Vssarray = Get-VBRJob -name $Jobname | Get-VBRJobObject

foreach ($Name in $VSSARRAY | where {$_.Name -Like "*-SQL-*"}) { Get-VBRJob -Name $Jobname | Get-VBRJobObject -Name $name | Set-VBRJobVssOptions -Options $VBRVSSOptions }


But this returns a very... weird error

Code: Select all
Get-VBRJobObject : The specified wildcard pattern is not valid: Id: [bbdd7fdd-4043-4e6a-8b91-9a7e11ed0486], ObjectId: [4519b933-9664-4785-8a24-e722ae9be9fc], JobId: [a7dc651b-f546-4ba2-8c38-2f558e8b12e1]FolderId: [00000000-0000-0000-0000-000000000000]
Location: [Pathinsidevcenter], Type: [Include], ApproxSize: [90040535724]
VssOptions: [VssSnapshotOptions: [Enabled: [True], IgnoreErrors: [False], IsCopyOnly: [False]], WinGuestFSIndexingOptions: [Type: [ExceptSpecifiedFolders], IncludedFolders: [], ExcludedFolders: [%windir%; %ProgramFiles%; %ProgramFiles(x86)%;
%ProgramW6432%; %TEMP%]], LinGuestFSIndexingOptions: [Type: [ExceptSpecifiedFolders], IncludedFolders: [], ExcludedFolders: [/cdrom; /dev; /media; /mnt; /proc; /tmp; /lost+found]], SqlBackupOptions: [TransactionLogsProcessing: [TruncateOnlyOnSuccessJob],
BackupLogsFrequencyMin: [15], UseDbBackupRetention: [True], RetainDays: [15], ProxyAutoSelect: [True]], ExchangeBackupOptions: [TransactionLogsProcessing: [TruncateOnlyOnSuccessJob]], WinCredsId: [00000000-0000-0000-0000-000000000000], LinCredsId:
[00000000-0000-0000-0000-000000000000], Old Properties: [Enabled: [True], IgnoreErrors: [False], GuestFSIndexingType: [ExceptSpecifiedFolders], IncludedIndexingFolders: [], ExcludedIndexingFolders: [%windir%; %ProgramFiles%; %ProgramFiles(x86)%;
%ProgramW6432%; %TEMP%], LinGuestFSIndexingType: [ExceptSpecifiedFolders], LinIncludedIndexingFolders: [], LinExcludedIndexingFolders: [/cdrom; /dev; /media; /mnt; /proc; /tmp; /lost+found], IsFirstUsage: [True]]],
Platform: [EVmware], UpdateVmx: [True]
DiskFilter: [Ver8|3000;3001;3002;3003;2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;2041;2042;2043;2044;2045;2046
;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063;16000;16001;16002;16003;16004;16005;16006;16008;16009;16010;16011;16012;16013;16014;16015;16016;16017;16018;16019;16020;16021;16022;16023;16024;16025;16026;16027;16028;16029;16
030;16031;16032;16033;16034;16035;16036;16038;16039;16040;16041;16042;16043;16044;16045;16046;16047;16048;16049;16050;16051;16052;16053;16054;16055;16056;16057;16058;16059;16060;16061;16062;16063;16064;16065;16066;16068;16069;16070;16071;16072;16073;16074;1
6075;16076;16077;16078;16079;16080;16081;16082;16083;16084;16085;16086;16087;16088;16089;16090;16091;16092;16093;16094;16095;16096;16098;16099;16100;16101;16102;16103;16104;16105;16106;16107;16108;16109;16110;16111;16112;16113;16114;16115;16116;16117;16118;
16119],
At line:1 char:94
+ ... ame $Jobname | Get-VBRJobObject -Name $name | Set-VBRJobVssOptions -Options $VBR ...
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VBRJobObject], WildcardPatternException
    + FullyQualifiedErrorId : RuntimeException,Veeam.Backup.PowerShell.Command.GetVBRJobObject
 
mgratla
Influencer
 
Posts: 19
Liked: never
Joined: Tue Feb 04, 2014 11:13 pm
Full Name: Mark

Re: Set VSS options for each machine in a job

Veeam Logoby v.Eremin » Thu Feb 26, 2015 10:33 am

The following example shows how to set the required settings for job object named SQLServer that is present inside "SQL Backup" Job. It shouldn't be that difficult to make the script set VSS options for all job objects which names contain "SQL":

Code: Select all
$Job = Get-VBRJob -Name "SQL Backup"
$Object = $Job | Get-VBRJobObject | ?{$_.name -eq "SQLServer"}
$VSSOptions = $Object.VssOptions
$VSSOptions.IgnoreErrors = $True
$VSSOptions.SqlBackupOptions.TransactionLogsProcessing = "NeverTruncate"
$Object.SetVssOptions($VSSOptions)

Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] : Set job VSS as "Ignore Failures"

Veeam Logoby Dario.Palmisano » Mon Mar 30, 2015 10:56 am

Hello,

I would like to set with powershell, the Application-aware VSS parameter for a Job as "Ignore Failures" (Try application processing, but ignore failures).

How is it possible?

Thanks

Dario
Dario.Palmisano
Enthusiast
 
Posts: 29
Liked: 2 times
Joined: Mon Nov 11, 2013 7:22 am
Full Name: Dario Palmisano

Re: Set VSS options for each machine in a job

Veeam Logoby v.Eremin » Mon Mar 30, 2015 11:03 am

Hi, Dario,

Kindly, check the post provided above; should be exactly what you're looking for.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set VSS options for each machine in a job

Veeam Logoby Dario.Palmisano » Mon Mar 30, 2015 11:46 am

Thanks,

if I set IgnoreErrors = $True and then access the Application-aware page of the user interface, I still see the Require success.

Is it an interface refresh problem or what?

Thanks and regards
Dario.Palmisano
Enthusiast
 
Posts: 29
Liked: 2 times
Joined: Mon Nov 11, 2013 7:22 am
Full Name: Dario Palmisano

Re: Set VSS options for each machine in a job

Veeam Logoby v.Eremin » Mon Mar 30, 2015 11:57 am

This setting is object specific. So, did you set it up for a particular VM present inside a job?

Code: Select all
$Object = $Job | Get-VBRJobObject | ?{$_.name -eq "Name of VM you want to setup the setting for"}


Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set VSS options for each machine in a job

Veeam Logoby Dario.Palmisano » Mon Mar 30, 2015 12:18 pm

Now I got it!

The settings regards the VM not the job (maybe not well expressed, but it works!)

Many thanks

Dario
Dario.Palmisano
Enthusiast
 
Posts: 29
Liked: 2 times
Joined: Mon Nov 11, 2013 7:22 am
Full Name: Dario Palmisano

Re: Set VSS options for each machine in a job

Veeam Logoby v.Eremin » Mon Mar 30, 2015 12:31 pm

The settings regards the VM not the job.

Correct.

If you want to set this setting for all VMs, you should create a loop similar to the following:

Code: Select all
$Job = Get-VBRJob -Name "Name of Job"
foreach ($Object in ($Job | Get-VBRJobObject))
{
$VSSOptions = $Object.VssOptions
$VSSOptions.IgnoreErrors = $True
$Object.SetVssOptions($VSSOptions)
}

Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 9 guests