我正在尝试使用此功能 Get-VSBSession 来获取SureBackup中失败的VM的错误消息。
这是我的脚本:
$vbrsessions = Get-VSBSession | ?{$_.result -ne "success"}
foreach ($session in $vbrsessions)
{
foreach ($failedVM in $session.GetTaskSessionsByResult(("failed")))
{
Write-Host "Job Name:" $failedVM.JobName
Write-Host "Status:" $FailedVM.Info.Result
Write-Host "VM:" $failedVM.Name
Write-Host "Error:" ???
}
}
获取错误消息的命令是什么?
谢谢
答案 0 :(得分:0)
$vbrsessions = Get-VSBSession | ?{$_.result -ne "success"}
foreach ($session in $vbrsessions)
{
foreach ($failedVM in $session.GetTaskSessionsByResult(("failed")))
{
Write-Host "Job Name:" $failedVM.JobName
Write-Host "Status:" $FailedVM.Info.Result
Write-Host "VM:" $failedVM.Name
Write-Host "Error: $(($failedVM.Logger.GetLog().UpdatedRecords | where Status -ne "ESucceeded" | select -ExpandProperty Title) -join ", ")"
}
}