Set-VBRJobObjectVssOptions -Credentials

PowerShell script exchange

Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Wed Mar 11, 2015 3:02 pm

Will someone please demonstrate how to correctly use the -Credentials parameter for the Set-VBRJobObjectVssOptions cmdlet?

For example, if I use the Get-VBRCredentials I get the following.

Code: Select all
Get-VBRCredentials

Name               Description
----               ----------
domain\veeambr      Veeam Backup and Recovery Account
root               FLR helper appliance credentials


Get-VBRCredentials -Name "*veeambr*"

Name               Description
----               ----------
domain\veeambr      Veeam Backup and Recovery Account


So I would think that the following code should work.

Code: Select all
$VBRCredentials = Get-VBRCredentials -Name "*veeambr*"

Get-VBRJob -Name "Test-Job" | Get-VBRJobObject -Name * | Set-VBRJobObjectVssOptions -Options $SomeOptionsIDefinedViaNewVBRJobVssOptions -Credentials $VBRCredentials


The Set-VBRJobObjectVssOptions cmdlet works if I do not include the -Credentials parameter. And I've tried the following options for the -Credentials parameter:

Code: Select all
-Credentials domain\veeambr
-Credentials "domain\veeambr"
-Credentials $VBRCredentials
-Credentials $VBRCredentials.Name


Each time, I get the following error:

Code: Select all
Set-VBRJobObjectVssOptions : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:57
+ Get-VBRJob -Name $job.Name | Get-VBRJobObject -Name * | Set-VBRJobObjectVssOptio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-VBRJobObjectVssOptions], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Veeam.Backup.PowerShell.Command.SetVBRJobObjectVssOptions


Unfortunately, neither the Get-Help Set-VBRJobObjectVssOptions -examples nor Veeam's online documentation provide and example of how to correctly use the -Credentials parameter. If someone can find documentation on how to use this parameter in this cmdlet, please chime in.
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Wed Mar 11, 2015 3:22 pm

Let's first clarify what you want to achieve. You're willing to set different account for different source VMs, right? (Guest Processing -> Customize guest OS credentials for individual VMs -> Credentials)
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Wed Mar 11, 2015 3:30 pm

I'm am attempting to do the opposite. I'm attempting to write a script that will change all of my existing backup jobs to have more uniform settings. One of the desired changes is to have them all use the same set of credentials.
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Wed Mar 11, 2015 3:47 pm

So, the main idea is to reset these settings

Image

and use this one, instead?

Image

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

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Wed Mar 11, 2015 6:10 pm

Correct. I don't actually make use of the "GUI > Edit Backup Job > Guest Processing > Customize guest OS credentials for individual VMs and operating systems" (e.g. all Guest OS Credentials are set to <Default>). I do make use of "GUI > Edit Backup Job > Guest Processing > Guest OS credentials > Credentials." We have a variety of credentials under "GUI > Edit Backup Job > Guest Processing > Manage Credentials" available in assigned to different backup jobs.

I'd like to have a PowerShell script to change all of the backup jobs to use the same Account/Credentials, among other settings.

Perhaps you are suggesting that I'm targeting the wrong place to set my credentials. And I think based on my earlier code example, you're right.

Instead of ...

Code: Select all
$VBRCredentials = Get-VBRCredentials -Name "*veeambr*"

Get-VBRJob -Name "Test-Job" | Get-VBRJobObject -Name * | Set-VBRJobObjectVssOptions -Options $SomeOptionsIDefinedViaNewVBRJobVssOptions -Credentials $VBRCredentials


... my example should have been for the job, not the job objects, like so ...

Code: Select all
$VBRCredentials = Get-VBRCredentials -Name "*veeambr*"

Get-VBRJob -Name "Test-Job" | Set-VBRJobVssOptions -Options $SomeOptionsIDefinedViaNewVBRJobVssOptions -Credentials $VBRCredentials


I also tried using the Set-VBRJobVssOptions instead of Set-VBRJobObjectVssOptions without success. I cannot figure out how to correctly use the -Credentials parameter in either example, nor find documentation on what type of values should be used for this parameter.

Here is the full script that I'm working on.

Code: Select all
# Clear the screen
Clear

# Get all backup jobs
# $jobs = Get-VBRJob | Where-Object { $_.IsBackup -eq $true }

# For testing, target just one job instead of all jobs
$jobs = Get-VBRJob -Name "Test-Job"

# BEFORE making changes to anything
$beforeJobVss = Get-VBRJob -Name $job.Name | Get-VBRJobVssOptions
$beforeJobObjectVss = Get-VBRJob -Name $job.Name | Get-VBRJobObject -Name * | Get-VBRJobObjectVssOptions

# BEGIN foreach loop ################

# Make the following changes to all backup jobs
foreach ($job in $jobs) {

   # BEGIN Job VSS Options #################

      # Create Job Processing Options
      $jobVssOptions = New-VBRJobVssOptions
      $jobVssOptions.VssSnapshotOptions.Enabled=$true
      $jobVssOptions.VssSnapshotOptions.IgnoreErrors=$false
      $jobVssOptions.Enabled=$true
      $jobVssOptions.IgnoreErrors=$false

      # Get Credentials
      $credentials = Get-VBRCredentials -Name "*veeam*"

      # Apply Job Processing Options with Credentials (Ugh! How do I get -Credentials to work?)
      # Get-VBRJob -Name $job.Name | Set-VBRJobVssOptions -Options $jobVssOptions -Credentials $credentials

      # Apply Job Processing Options without Credentials
      Get-VBRJob -Name $job.Name | Set-VBRJobVssOptions -Options $jobVssOptions

   # END Job VSS Options ####################
   # BEGIN Job Object VSS Options #################

      # Create Guest Processing Options
      $jobVssObjectOptions = New-VBRJobVssOptions
      $jobVssObjectOptions.VssSnapshotOptions.Enabled=$true
      $jobVssObjectOptions.VssSnapshotOptions.IgnoreErrors=$true
      $jobVssObjectOptions.Enabled=$true
      $jobVssObjectOptions.IgnoreErrors=$true

      # Get Credentials (commented out because it should inherit from Set-VBRJobVssOptions)
      # $credentials = Get-VBRCredentials -Name "*veeam*"

      # Apply Guest Processing Options with Credentials (shouldn't be needed because credentials should be inherited from job)
      # Get-VBRJob -Name $job.Name | Get-VBRJobObject -Name * | Set-VBRJobObjectVssOptions -Options $jobVssObjectOptions -Credentials $credentials

      # Apply Guest Processing Options without Credentials
      Get-VBRJob -Name $job.Name | Get-VBRJobObject -Name * | Set-VBRJobObjectVssOptions -Options $jobVssObjectOptions

   # END Job Object VSS Options ####################

   # Report which jobs received these changes
   Write-Host "Changed settings for" $job.Name
}
# END foreach loop ################

# AFTER making changes
$afterJobVss = Get-VBRJob -Name $job.Name | Get-VBRJobVssOptions
$afterJobObjectVss = Get-VBRJob -Name $job.Name | Get-VBRJobObject -Name * | Get-VBRJobObjectVssOptions

# COMPARE JobVss results
$beforeJobVss
$afterJobVss

# COMPARE JobObjectVss results
$beforeJobObjectVss
$afterJobObjectVss
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Thu Mar 12, 2015 1:17 pm

My intention here is not to have someone poor over my script. I posted the full script to provide context.

What I'm really seeking are examples on how to use the -Credential(s) parameter correctly when using either the Set-VBRJobVssOptions or Set-VBRJobObjectVssOptions cmdlets.

It is important to note the spelling inconstancy of this parameter. For some reason, one parameter is singular while the other is plural. Perhaps it implies that for the parameter that is plural, multiple credentials can be entered as values.

http://helpcenter.veeam.com/backup/80/p ... tions.html uses the singular parameter:

Code: Select all
Set-VBRJobVssOptions [-Job] <CBackupJob[]> [-Options] <CVssOptions> -Credential <CCredentials>


http://helpcenter.veeam.com/backup/80/p ... tions.html uses the plural parameter:

Code: Select all
Set-VBRJobObjectVssOptions [-Object] <CObjectInJob> -Credentials <CCredentials>


Both state "Specifies the credentials you want to use for authenticating with the guest VM", using the plural form of credentials in both descriptions. Perhaps this is another inconsistent typographical error in Veeam's PowerShell (e.g. note how the parameter -Periodicaly is misspelled while the following parameter -PeriodicallyKind is spelled correctly in this cmdlet Set-VBRJobSchedule -Job <CBackupJob[]> [-Periodicaly] [-FullPeriod <Int32>] [-PeriodicallyKind <PeriodicallyOptions+PeriodicallyKinds>]).

Neither document nor Get-Help results provide an example of how to use -Credential or -Credentials in these two cmdlets. What values may I enter that would be accepted?
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Thu Mar 12, 2015 2:20 pm

My intention here is not to have someone poor over my script. I posted the full script to provide context.

Set-VBRJobVSSOptions -Credentials sets AAIP credentials on job level:

Code: Select all
$Job = Get-VBRJob -Name "Temp VM"
Set-VBRJobVssOptions -Job $Job -Credentials (Get-VBRCredentials -Name "Test01")


Image

Set-VBRJobObjectVssOptions -Credentials set credentials on job object level:

Code: Select all
$JobObject = $Job | Get-VBRJobObject -Name "Temp VM"
Set-VBRJobObjectVssOptions -Object $JobObject -Credentials (Get-VBRCredentials -Name "Test02")


Image

As to our online help center, whenever you feel the information provided there is either misleading or incomplete you can use the "send feedback" link at the bottom of the page. Tech writers team behind that resource reacts to such feedback in timely fashion.

Speaking about -Periodically switch, I will notify required team in order to correct it.

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

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Thu Mar 12, 2015 9:14 pm

Thank you for the clarification and documentation on how to use that parameter.

Regarding the -Periodicaly parameter, it appears that the misspelling is not an error in the documentation but is instead an error in the Veeam PowerShell language:

Code: Select all
Set-VBRJobSchedule -Job  [-Periodicaly] [-FullPeriod ] [-PeriodicallyKind ])


If I spell the parameter correctly (as -Periodically), I receive an error.

Regarding the -Credential vs -Credentials parameter inconsistency (singular vs plural), I am uncertain if that is a documentation error or another Veeam PowerShell issue.

Code: Select all
Set-VBRJobVssOptions [-Job]  [-Options]  -Credential  [-WarningAction ] [-WarningVariable ] []
Set-VBRJobObjectVssOptions [-Object]  -Credentials  [-WarningAction ] [-WarningVariable ] []


Can you determine if this inconsistency is a documentation or syntax error? At first I thought it was a documentation error because Get-Help for both cmdlets used the plural version. But when I test the singular version of the cmdlet, I do not get an error. What is the correct tense of this parameter, and is that tense the same across all cmdlets?

Lastly, thank you for pointing out how to provide feedback to the online documentation. Is that the same method I'd used to provide feedback to the Get-Help content? How to I download and obtain updated Get-Help content?
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Fri Mar 13, 2015 9:08 am

Regarding the -Periodicaly parameter, it appears that the misspelling is not an error in the documentation but is instead an error in the Veeam PowerShell language:

You're right the typo is in PowerShell snap-in. It might be tricky to correct it, though. As it can probably affect number of existing scripts. Anyway, we will think how we can address it in the next release.

Regarding the -Credential vs -Credentials parameter inconsistency (singular vs plural), I am uncertain if that is a documentation error or another Veeam PowerShell issue.

In both commandlets -Credentials should be plural.

Is that the same method I'd used to provide feedback to the Get-Help content?

Yep, I believe you can provide your feedback regarding Get-Help commandlet there as well.

How to I download and obtain updated Get-Help content?

Content of Get-Help typically gets updated with every major release of our product.

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

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Fri Mar 13, 2015 3:03 pm

Thank you.

As it can probably affect number of existing scripts. Anyway, we will think how we can address it in the next release.


Perhaps the solution is to accept either parameters as valid parameters. E.g. -Periodicaly or -Periodically. Your team has already created several cmdlets that have different scopes. See http://helpcenter.veeam.com/backup/80/p ... tions.html.

In both commandlets -Credentials should be plural


Great. That's easier for you to fix as it should just require updating your documentation.

Content of Get-Help typically gets updated with every major release of our product.


Ok. But would be ideal of your Help documentation could be updated out of cycle using a command similar to Update-Help; perhaps Update-VBRHelp. Thanks for your time.
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Fri Mar 13, 2015 4:14 pm

Perhaps the solution is to accept either parameters as valid parameters. E.g. -Periodicaly or -Periodically.

Yep, I was thinking more or less similarly. Will what can be done in this regard.

Great. That's easier for you to fix as it should just require updating your documentation.

I've notified the responsible team already; should be fixed soon.

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

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Sat Mar 14, 2015 1:09 pm

I'm still having problems using the -Credentials parameter for some cmdlets. In this case, I'm having a problem with the Set-VBRJobVssOptions cmdlet.

I created a dummy Guest Processing > Guest OS Credentials > Credentials account named "testdummy". If I use the Get-VBRCredentials cmdlet, I can retrieve it just fine and without error:

Code: Select all
PS C:\> Get-VBRCredentials -Name test*

Name                           Description
----                           -----------
testdummy                      testdummy


But if I attempt to use the exact same cmdlet as a value for the -Credentials parameter, I get an error. Note that the values in the other variables are fine, as the Set-VBRJobVssOptions cmdlet will work if I exclude the -Credentials parameter:

Code: Select all
PS C:\> Set-VBRJobVssOptions -Job $job -Options $VssOptions -Credentials (Get-VBRCredentials -Name test*)
Set-VBRJobVssOptions : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Set-VBRJobVssOptions -Job $job -Options $VssOptions -Credentials (Get-VBRCredent ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-VBRJobVssOptions], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Veeam.Backup.PowerShell.Command.SetVBRJobVssOptions


I appear to be back at my original problem in that I cannot figure out how to provide the -Credentials parameter a value that it will except. The example you provided earlier in this forum seemed logical, but I am unable to duplicate your success. I'm using Veeam BR version 8 with update 1.
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby jasonpearce » Sat Mar 14, 2015 1:57 pm 2 people like this post

I think I figured it out. I've found yet another Veeam PowerShell documentation error.

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

If you look at the Set-VBRJobVssOptions, the online documented Syntax is:

Code: Select all
Set-VBRJobVssOptions [-Job] <CBackupJob[]> [-Options] <CVssOptions> -Credential <CCredentials> [-WarningAction <ActionPreference>] [-WarningVariable <String>] [<CommonParameters>]


We've already determined that the first online documentation error is that it uses the singular-tense -Credential parameter (incorrect) when it is supposed to be the plural-tense -Credentials parameter (correct).

Accounting for the plural-tense adjustment, my script meets the documented-online Syntax requirements:

Code: Select all
Set-VBRJobVssOptions -Job $job -Options $VssOptions -Credentials (Get-VBRCredentials -Name test*)


Yet when I run the Set-VBRJobVssOptions cmdlet with all three -Job, -Options, and -Credentials (plural) parameters (as documented), I get this error:

Code: Select all
PS C:\> Set-VBRJobVssOptions -Job $job -Options $VssOptions -Credentials (Get-VBRCredentials -Name test*)
Set-VBRJobVssOptions : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Set-VBRJobVssOptions -Job $job -Options $VssOptions -Credentials (Get-VBRCredent ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-VBRJobVssOptions], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Veeam.Backup.PowerShell.Command.SetVBRJobVssOptions


It turns out that I found a second problem with the online documentation.

If you look at Get-Help Set-VBRJobVssOptions -full, it has two Syntax descriptions, not one. The first has both the -Job and -Options parameters, but no -Credentials parameter as described in the online documentation. The second Syntax description has both the -Job and -Credentials parameters, but no -Options.

Code: Select all
PS C:\> Get-help Set-VBRJobVssOptions -full

NAME
    Set-VBRJobVssOptions

SYNOPSIS
    Applies custom VSS settings to a selected job.

SYNTAX
    Set-VBRJobVssOptions [-Job] <CBackupJob[]> [-Options] <CGuestProcessingOptions> [-WarningAction
    <ActionPreference>] [-WarningVariable <String>] [<CommonParameters>]

    Set-VBRJobVssOptions [-Job] <CBackupJob[]> -Credentials <CCredentials> [-WarningAction <ActionPreference>]
    [-WarningVariable <String>] [<CommonParameters>]


I've once again been misled by Veeam's online documentation. To properly set both the VSS Options and the VSS Credentials for a job, one cannot use all three parameters at the same time and instead must run the cmdlet twice, each time using just two of the three parameters, like so:

Code: Select all
Set-VBRJobVssOptions -Job $job -Options $VssOptions

Set-VBRJobVssOptions -Job $job -Credentials (Get-VBRCredentials -Name Test*)


That works.

Veeam's online documentation inconsistencies have made learning and using Veeam PowerShell this past week a frustrating experience (see https://www.jasonpearce.com/2015/03/12/ ... istencies/). The Get-Help documentation is more accurate than the documentation found online. It was naive of me to assume online and embedded documentation would be the same and equally accurate.

To avoid misleading other users, Veeam should replace all of its online Veeam PowerShell documentation with an exact copy of the documentation that can be retrieved via Get-Help. That way the online documentation would at least be consistent, and likely more accurate.

If the online documentation matched the Get-Help documentation, three of the four problems I've experienced this week would not have been an issue. In the meantime, my lesson is to stop referencing the online documentation as it misleading and contains several errors.
jasonpearce
Influencer
 
Posts: 23
Liked: 5 times
Joined: Wed Mar 11, 2015 2:31 pm
Full Name: Jason Pearce

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Wed Mar 18, 2015 11:35 am

The PS section of our online Help Center has been revised seriously with the release of version 8 to be better structured and be more convenient for end-users. Comparing with its previous version, I can say that those goals have been achieved.

Some minor issues are still present, though. But the corresponding team is working hard to address.

I've passed your feedback to techwritters, so, the mentioned inconsistencies should be fixed soon.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set-VBRJobObjectVssOptions -Credentials

Veeam Logoby v.Eremin » Thu Mar 19, 2015 10:51 am

The said inconsistency has been already fixed in the online documentation. Try to refresh the referenced page, using Ctrl+F5.
Syntax

Set-VBRJobVssOptions [-Job] <CBackupJob[]> [-Options] <CGuestProcessingOptions> [<CommonParameters>]

-OR-

Set-VBRJobVssOptions [-Job] <CBackupJob[]> -Credentials <CCredentials> [<CommonParameters>]


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

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests