Ian Cook wrote:Hi Thomas, sorry for the slow reply, been a bit busy this week.
Ran the updated script, and this is the output
Code: Select all
"Error: Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
I have already been through the settings to allow remote connections, as its SQL Express 2008
Thankis again for the assistance
Ian
i having the same error msg . my Veeam B & R is win2k8 R2 SP1 with latest patches, SQL2005 Express Bundle with Veeam( Default setting) , Enabled TCP/IP & Names Pipes Protocol At SQL Server configuration Manger. My custom scripts as below , even i change server name to ip address also same result. Please help. TQVM
asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue
$VCVMName = "vcenter"
$serverName = "$env:VMSVEEAM10\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
{
"Error: $_"
break
}
try
{
$cmd.ExecuteNonQuery() | Out-Null
}
catch
{
Write-Warning "Update failed"
}
finally
{
$conn.Close()
}