PowerShell script exchange
Post Reply
jlsung
Influencer
Posts: 21
Liked: never
Joined: Sep 15, 2011 1:41 pm
Contact:

VSS Options Credentials

Post by jlsung »

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,
Sethbartlett
Veteran
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: VSS Options Credentials

Post by Sethbartlett »

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.
jlsung
Influencer
Posts: 21
Liked: never
Joined: Sep 15, 2011 1:41 pm
Contact:

Re: VSS Options Credentials

Post by jlsung »

$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
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: VSS Options Credentials

Post by ThomasMc »

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
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: VSS Options Credentials

Post by ThomasMc »

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

Re: VSS Options Credentials

Post by ThomasMc »

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"}
jlsung
Influencer
Posts: 21
Liked: never
Joined: Sep 15, 2011 1:41 pm
Contact:

Re: VSS Options Credentials

Post by jlsung »

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: Sep 15, 2011 1:41 pm
Contact:

Re: VSS Options Credentials

Post by jlsung »

It doesn't work, I had the same error.
I tested the same script in V6 and no issue
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: VSS Options Credentials

Post by ThomasMc »

I've not got v5 to test now so I will have to leave you in the capable hands of Seth :)
Sethbartlett
Veteran
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: VSS Options Credentials

Post by Sethbartlett »

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.
jlsung
Influencer
Posts: 21
Liked: never
Joined: Sep 15, 2011 1:41 pm
Contact:

Re: VSS Options Credentials

Post by jlsung »

@Thomas : Thanks :)
@Seth : #5164566
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests