HOWTO: Backing up vCenter host issues

PowerShell script exchange

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby azuegler » Wed Jun 06, 2012 11:40 am

Hi all,

does anyone know if there is a solution for this implemented in B&R Version 6.1?

Best regards,
Andreas
azuegler
Influencer
 
Posts: 11
Liked: never
Joined: Wed Jun 06, 2012 8:57 am

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Gostev » Wed Jun 06, 2012 11:58 am

No changes in 6.1.
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby azuegler » Wed Jun 06, 2012 12:01 pm

Thanks for the quick reply. Is it planned in future releases?

BR,
Andreas
azuegler
Influencer
 
Posts: 11
Liked: never
Joined: Wed Jun 06, 2012 8:57 am

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Gostev » Wed Jun 06, 2012 1:16 pm

Why are you keep posting the same questions in two different threads? :D
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby azuegler » Wed Jun 06, 2012 1:58 pm

Because my first post was a new thread and in review state and because I didnt mention a support case ID i thought that it wont be accepted by the Moderators. Sorry for that.
azuegler
Influencer
 
Posts: 11
Liked: never
Joined: Wed Jun 06, 2012 8:57 am

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Gostev » Wed Jun 06, 2012 2:51 pm

Oh, OK. Actually, product and feature questions do not require support case ID, only technical issues do (bugs, errors any sort of malfunctions).
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby itwheel » Thu Jun 14, 2012 6:04 pm

I tried your troubleshooting step because I was getting the same type of error -

ThomasMc wrote:Change
Code: Select all
try
{
   $conn.Open()
}
catch
{
   Write-Warning "Couldn't open connection"
   break
}


to
Code: Select all
try
{
   $conn.Open()
}
catch
{
   "Error: $_"
   break
}

and paste the results


My code is as follows:
Code: Select all
asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "DUvCenter"
$serverName = "$env:computername\VEEAM"           
$databaseName = "VeeamBackup"

$vc = Find-VBRViEntity -Name $VCVMName | ?{$_.Reference -notlike "vm-*"}
     
$conn = New-Object System.Data.SQLClient.SQLConnection
$conn.ConnectionString = "Server=$serverName;Database=$databaseName;Integrated Security=SSPI;"

$cmd = New-Object System.Data.SQLClient.SQLCommand
$cmd.Connection = $conn
$cmd.CommandText = "UPDATE [BObjects] set host_id = '$($vc.ConnHost.Id)',
object_id = '$($vc.Reference)',
path = '$($vc.Path)' WHERE object_name = '$VCVMName' AND object_id NOT LIKE 'vm%'"

try
{
   $conn.Open()
}
catch
{
   Write-Warning "Couldn't open connection"
   break
}

<# try
{
   $cmd.ExecuteNonQuery() | Out-Null
}
catch
{
   Write-Warning "Update failed"
}
finally
{
   $conn.Close()
}
#>
try
{
$cmd.ExecuteNonQuery() | Out-Null
}
catch
{
"Error: $_"
}
finally
{
$conn.Close()
}


Result:
Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "Conversion failed
when converting from a character string to uniqueidentifier."

Any Advice?
itwheel
Lurker
 
Posts: 2
Liked: never
Joined: Thu May 24, 2012 4:25 pm
Full Name: MARCUS D RODGERS

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Sethbartlett » Fri Jun 15, 2012 12:36 am

I would check the output of $cmd.CommandText and see if it looks like what you expect the SQL query to look like or if it's messed up. This part is probably messing it up:

object_name = '$VCVMName'

You have everything else as $($variable) and that by itself, it cannot convert properly, just either do $($VCVMName) or object_name = '" + $VCVMName + "'AND...
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: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Sun Jun 17, 2012 11:20 am


I would check the output of $cmd.CommandText and see if it looks like what you expect the SQL query to look like or if it's messed up. This part is probably messing it up:

object_name = '$VCVMName'

You have everything else as $($variable) and that by itself, it cannot convert properly, just either do $($VCVMName) or object_name = '" + $VCVMName + "'AND...


That's how I wrote it :)

I would say the GUID is either missing or not returning how we would expect it to, so first if you could answer what version of Veeam your using and change the error trap a little to give us more info

Code: Select all
try
{
   $conn.Open()
}
catch
{
   "GUID: $($vc.Reference)"
   $vc.Reference | Measure-Object -Character
   "Error: $_"
   break
}
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Sat Jun 23, 2012 1:05 pm

Sorry, I selected the wrong command, try this
Code: Select all
try
{
$cmd.ExecuteNonQuery() | Out-Null
}
catch
{
   "GUID: $($vc.Reference)"
   $vc.Reference | Measure-Object -Character
   "Error: $_"
   break
}
finally
{
$conn.Close()
}
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby fcastro » Fri Jul 13, 2012 4:26 pm

v6.1 sql2k8R2 express

hi many tanks for the script workout. i am not passing the problem below:
Code: Select all
asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "vcenter"
$serverName ="$env:computername\SQLEXPRESS"
$databaseName = "VeeamBackup"

$vc = Find-VBRViEntity -Name $VCVMName | ?{$_.Reference -notlike "vm-*"}

$conn = New-Object System.Data.SQLClient.SQLConnection
$conn.ConnectionString = "Server=$serverName;Database=$databaseName;Integrated Security=SSPI;"

$cmd = New-Object System.Data.SQLClient.SQLCommand
$cmd.Connection = $conn
$cmd.CommandText = "UPDATE [BObjects] set host_id = '$($vc.ConnHost.Id)',
object_id = '$($vc.Reference)',
path = '$($vc.Path)' WHERE object_name = '$VCVMName' AND object_id NOT LIKE 'vm%'"


try
{
$conn.Open()
}
catch
{
Write-Warning "Couldn't open connection"
break
}

try
{
$cmd.ExecuteNonQuery() | Out-Null
}
catch
{
"GUID: $($vc.Reference)"
$vc.Reference | Measure-Object -Character
"Error: $_"
break
}
finally
{
$conn.Close()
}



output:

PS C:\> C:\go.ps1
GUID:

Lines Words Characters Property
----- ----- ---------- --------
0
Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "Conversion failed when converting from
a character string to uniqueidentifier."

_____________________________________________________________________________________________________


found it by cmd:

PS C:\> $teco= Get-VBRJob -name "ALL" | Get-VBRJobObject -NAME "vcenter"
PS C:\> $teco.info.Objectid

Guid
----
dcad4480-9299-48fb-ac1e-893f3ebf5857
fcastro
Novice
 
Posts: 8
Liked: never
Joined: Thu Apr 05, 2012 10:52 am
Full Name: Fausto Castro

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Fri Jul 13, 2012 11:51 pm

I'll have a look to see what's been changed in the latest version
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Wed Jul 18, 2012 3:44 pm

This should fix it, some bright spark thought he could make up the rules with this one :S

*6.1 only*

change
Code: Select all
$vc = Find-VBRViEntity -Name $VCVMName | ?{$_.Reference -notlike "vm-*"}


to
Code: Select all
$vc = Find-VBRViEntity -Name $VCVMName | ?{($_.Reference -notlike "vm-*") -AND ($null -ne $_.Reference)}
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby fcastro » Wed Jul 18, 2012 4:41 pm

tanks,
gives the bellow error:

GUID:

Lines Words Characters Property
----- ----- ---------- --------
0
Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "Conversion failed when converting from a character string to uniqueidentifier."
fcastro
Novice
 
Posts: 8
Liked: never
Joined: Thu Apr 05, 2012 10:52 am
Full Name: Fausto Castro

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Wed Jul 18, 2012 5:08 pm

can you post the output of the below command

Code: Select all
Find-VBRViEntity -Name "your.vcenter.vm"


thanks
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

PreviousNext

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 2 guests