I created a script to retrieve the "current/last" backup status of a VM within veeam jobs.
In this script I've used the "[Veeam.Backup.DBManager.CDBManager]" class that has the function of displaying all backup sessions with relative details.
If I run the command (which includes the above mentioned class):
Code: Select all
$Sessions= foreach ($bsession in ([Veeam.Backup.DBManager.CDBManager]::Instance.BackupJobsSessions.GetAll() | Where-Object {$_.JobType -eq "Backup" -and $_.EndTime -ge (Get-Date).addhours(-24)}))
{
Get-VBRTaskSession ([Veeam.Backup.Core.CBackupSession]::Create($bsession, $null))
}
directly from powershell there is no problem, but if I invoke the same script form Windows CMD prompt by this way:
Code: Select all
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -file C:\Zabbix\veeam\Veeam_VM_Status.ps1 "[VM_NAME]" "[JOB_NAME]"
Code: Select all
The [Veeam.Backup.DBManager.CDBManager] type could not be found. Verify that "the assembly" containing this type is loaded.
In C:\Zabbix\veeam\Veeam_VM_Status.ps1:45 car:73
+ $Sessions= foreach ($bsession in ([Veeam.Backup.DBManager.CDBManager] <<<<
::Instance.BackupJobsSessions.GetAll() | Where-Object {$_.JobType -eq "Backup"
-and $_.EndTime -ge (Get-Date).addhours(-24)}))
+ CategoryInfo : InvalidOperation: (Veeam.Backup.DBManager.CDBMan
ager:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Where can I find or how can I put the assembly not found" and solve the problem? Any suggestions?
Thank you
F.