The work around for this is to add your ESX/ESXi host into Veeam aside from your VC. So for example:
vSphere Client to the VC Shows:
esx1.host.local
esx2.host.local
esx3.host.local
You would want to add in the host that manages your VC by IP address into Veeam.
vSphere Client to the VC Shows:
192.168.1.100
192.168.1.101
192.168.1.102
You would want to add in the host that manages your VC by netname. If it does not have a netname, you can add an entry into your hosts file on the Veeam box. After you add your host into Veeam, you will need to backup your VC by picking your host directly, rather than drilling down through your VC. The issue that comes with this is that if you vMotion your VC or have to move/re-add to inventory, the reference ID of the VC VM changes. This will in turn, break the job and you will get something like "Object reference not set to an instance of an object" or "Object not found", something along these lines.
So the real question is, how do you fix this without doing a brand new full every time.
The requirements:
- vPower CLI
- Connection to Veeam Database
So the first part, vPower CLI:
Code: Select all
#First, we need to connect to the VC to get information about the host that manages it
#User/Password are optional and a prompt will come up for you to type credentials, you can also supply
PSCredential
$VC = Connect-VIServer "VC" -User "MyUser" -Password "MyPassword"
$myHost = (Get-VM "vCenter Name" -Server $VC).VMHost
if($myHost.name -match "((\d{1,3})\.?){4}")
{
$ServerName = [System.Net.DNS]::GetHostbyAddress(matches[0])
}
else
{
$ServerName = [System.Net.DNS]::GetHostAddresses($myHost.name)[0].ipaddresstostring
}
# Now we need to connect to the host that the VC is on
$tempHost = Connect-VIServer $myHost.name -user "MyUser" -Password "MyPassword"
$vm = Get-VM "vCenter Name" -Server $tempHost
$id = $vm.id -replace '[a-z]+-'
asnp "VeeamPSSnapIn"
$Server = Get-VBRServer | ?{$_.name -eq $ServerName }
The script we are going to run is:
Code: Select all
UPDATE [BObjects] set host_id = $Server.id, object_id=$id WHERE object_name = $vm.name AND object_id NOT
LIKE 'vm%'
Code: Select all
sqlcmd -s SERVERNAME\INSTANCE -d Database -q "The query above"
Code: Select all
$Connection = New-Object System.Data.SQLClient.SQLConnection
$Connection.ConnectionString = "server=servername;database=VeeamBackup;trusted_connection=true;"
$Connection.Open()
$Command = New-Object System.Data.SQLClient.SQLCommand
$Command.Connection = $Connection
$Command.CommandText = "UPDATE [BObjects] set host_id = $Server.id, object_id=$id WHERE object_name =
$vm.name AND object_id NOT LIKE 'vm%'"
$Command.ExecuteNonQuery()