[英]How can I see the Write-Host output of a script resource in Powershell DSC?
[英]Can't see write-host output in the log when running PowerShell in Azure in "Code + Test"
我在 run.ps1 中有簡單的腳本
# Input bindings are passed in via param block.
param($Timer)
# Get the current universal time in the default string format.
$currentUTCtime = (Get-Date).ToUniversalTime()
# The 'IsPastDue' property is 'true' when the current function invocation is later than scheduled.
if ($Timer.IsPastDue) {
Write-Host "PowerShell timer is running late!"
}
# Write an information log with the current time.
Write-host "PowerShell timer trigger function ran!"
Write-Debug "PowerShell timer trigger function ran! TIME: $currentUTCtime"
為什么我可以在底部的日志中看到“”PowerShell timer trigger function ran?”?
感謝@Dilly B,我已經在我的環境中重現並得到如下預期結果:
首先,我使用了Write-Host
並且 Ouput 顯示在 Output 屏幕中,如下所示:
然后我使用了Write-Output
並得到了如下日志:
Output 在日志中:
編輯:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.