如何使RunBook识别DateTime类型?

我正在Azure自动化中创建Powershell工作流。 在使用功能设置DateTime类型this.loader.dismiss() 时, 识别为字符串。如果您知道如何解决,请告诉我。

this.loader.dismiss().then(value => {
    console.log("dismiss worked!");
},reason => {
    console.log("dismiss rejected!");
});

执行后,从Azure门户确认的Set-AutomationVariable的值如下:

workflow variabletest{

     function Test-DateTime {
        $Now = Get-Date
       Set-AutomationVariable -Name 'VariableDateTime' -Value ($Now)
    }

     Test-DateTime

}

如果函数外有'VariableDateTime',则已确认它成为DateTime类型。

谢谢。

wyq8965 回答:如何使RunBook识别DateTime类型?

我可以重现您的问题,似乎是Get-Date命令的设计。

请参见Outputs

  

当DateTime对象通过管道发送到cmdlet(例如需要字符串输入的Add-Content)时, PowerShell将该对象转换为String对象

需要了解管道的功能必须在管道支持下构建。

本文链接:https://www.f2er.com/2937556.html

大家都在问