0

当我写输出行时,我试图获得一个时间戳。我尝试了几件事,并以:

filter timestamp {"$(Get-Date -Format G): $_"}
Write-Output "JOB START BEFORE INLINESCRIPT" | timestamp

但这给了我错误:

The 'timestamp' activity is not supported in a workflow pipeline

这样做的正确方法是什么?

4

1 回答 1

1

您应该将代码放在InlineScript块中,如下所示:

workflow MyFirstRunbook-Workflow
{   
   INLINESCRIPT{
    write-output "hello world"
    filter timestamp {"$(Get-Date -Format G): $_"}
    write-output "JOB START BEFORE INLINESCRIPT" | timestamp
   }    
}

测试结果:

在此处输入图像描述

于 2019-01-17T04:06:50.843 回答