[英]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.