0

我正在尝试使用此函数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:" ???
   }
} 

获取错误消息的命令是什么?

谢谢

4

1 回答 1

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 ", ")"
   }
}
于 2020-02-11T13:14:13.237 回答