diff --git a/tools/devops/automation/scripts/generate_agent_logs.ps1 b/tools/devops/automation/scripts/generate_agent_logs.ps1 index 089a65511e1a..3294e9138cc5 100644 --- a/tools/devops/automation/scripts/generate_agent_logs.ps1 +++ b/tools/devops/automation/scripts/generate_agent_logs.ps1 @@ -46,8 +46,7 @@ try { log show --predicate $Predicate --style $Style --start "$start" --end "$end" > $Output } } catch { - Write-Host "Exception occurred: $_" # Create the output file, because we later try to upload it as an artifact, and *not* uploading # if there's *no* file is much harder than just creating the file. - New-Item -Path $Output -Value "$_" + Write-Host "Exception occurred: $_" | Tee-Object -FilePath $Output -Append }