VSS Options Credentials

PowerShell script exchange

VSS Options Credentials

Veeam Logoby jlsung » Wed Jan 04, 2012 10:10 am

Hello,

I've modified VssChild object credentials (B&R 5.0.2)by the code below :

Code: Select all
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $login,$password,0,0            
$Options = $VssChild.GetVssOptions()
$Options.Credentials = $Credentials
$VssChild.SetVssOptions($Options)


Error message :
Cannot login into the virtual machine: [[SAN0xxxx] xxxxxx.vmx]. User: [xxxxxx].
VIX Error: The guest does not support empty passwords Code: 3033


When I checked the the VssChild object, the password field is not empty...
Any idea ?

Thanks,
jlsung
Influencer
 
Posts: 21
Liked: never
Joined: Thu Sep 15, 2011 1:41 pm

Re: VSS Options Credentials

Veeam Logoby Sethbartlett » Wed Jan 04, 2012 12:48 pm

I'm not sure what $VssChild is, unless that is your job? Typically you would want to do:

Code: Select all
$Job = Get-VBRJob -name "MyJob"
$VSS = $Job.GetVssOptions()
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList "User","Password",0,0
$VSS.Credentials = $Credentials
Job.SetVssOptions($VSS)
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: VSS Options Credentials

Veeam Logoby jlsung » Wed Jan 04, 2012 2:15 pm

$Vsschild is an object in my job.

I want to set an username and password for each VM my job. Credentials are different for each VM.
The issue is the field username/password are not empty but I've got the error
VIX Error: The guest does not support empty passwords Code: 3033
jlsung
Influencer
 
Posts: 21
Liked: never
Joined: Thu Sep 15, 2011 1:41 pm

Re: VSS Options Credentials

Veeam Logoby ThomasMc » Wed Jan 04, 2012 3:06 pm

Your object might have a password set but that doesn't mean the job was updated properly and thus still have a blank password, I've tested it this way and works as expected

Code: Select all
PS C:\> $job = Get-VBRJob -Name "Backup Job"
PS C:\> $jobVSS = $job | Get-VBRJobVSSOptions
PS C:\> $Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList "lab\administrator","HisPass",0,0
PS C:\> $jobVSS.Credentials = $Credentials
PS C:\> $job | Set-VBRJobVssOptions -Options $jobVSS
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: VSS Options Credentials

Veeam Logoby ThomasMc » Wed Jan 04, 2012 3:14 pm

ah never mind I get you now, I'll be back :D
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: VSS Options Credentials

Veeam Logoby ThomasMc » Wed Jan 04, 2012 3:53 pm

This any good to you

Code: Select all
function Set-JOBJVSSOpt {
   param(
      [PsObject]$VSSObj,
      [String]$Username,
      [String]$Password,
      [String]$Domain
      )
   Begin {
      $Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList "$Domain\$Username","$Password",0,0
   }
   Process {
      $VSSObjCreds = $VSSObj.GetVSSOptions()
      $VSSObjCreds.Credentials = $Credentials
   }
   End {
      $VSSObj.SetVssOptions($VSSObjCreds)
   }
}

PS C:\> $job = Get-VBRJob -Name "Backup Job 4"
PS C:\> $jobObjs = $job | Get-VBRJobObject
PS C:\> $jobObjs | %{Set-JOBJVSSOpt $_ "UserName" "Password" "Domain"}
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: VSS Options Credentials

Veeam Logoby jlsung » Wed Jan 04, 2012 4:37 pm

ThomasMc wrote:Your object might have a password set but that doesn't mean the job was updated properly and thus still have a blank password, I've tested it this way and works as expected

Code: Select all
PS C:\> $job = Get-VBRJob -Name "Backup Job"
PS C:\> $jobVSS = $job | Get-VBRJobVSSOptions
PS C:\> $Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList "lab\administrator","HisPass",0,0
PS C:\> $jobVSS.Credentials = $Credentials
PS C:\> $job | Set-VBRJobVssOptions -Options $jobVSS


After updating the object, I made a new query to get vss options and the VM's VSS credentials is set.
I'll test this function
jlsung
Influencer
 
Posts: 21
Liked: never
Joined: Thu Sep 15, 2011 1:41 pm

Re: VSS Options Credentials

Veeam Logoby jlsung » Wed Jan 04, 2012 5:00 pm

It doesn't work, I had the same error.
I tested the same script in V6 and no issue
jlsung
Influencer
 
Posts: 21
Liked: never
Joined: Thu Sep 15, 2011 1:41 pm

Re: VSS Options Credentials

Veeam Logoby ThomasMc » Wed Jan 04, 2012 5:25 pm

I've not got v5 to test now so I will have to leave you in the capable hands of Seth :)
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: VSS Options Credentials

Veeam Logoby Sethbartlett » Wed Jan 04, 2012 9:20 pm

Could you create a ticket and state that it needs to be assigned to me per this forum post and let me know the case # on here?
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: VSS Options Credentials

Veeam Logoby jlsung » Thu Jan 05, 2012 7:56 am

@Thomas : Thanks :)
@Seth : #5164566
jlsung
Influencer
 
Posts: 21
Liked: never
Joined: Thu Sep 15, 2011 1:41 pm


Return to PowerShell



Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 6 guests