Make a powershell script with a Datetime parameter that has a (Get-Date) default value:
param (
[Parameter()] [Datetime] $DateExample = (Get-Date)
)
Upload the script as draft to the portal
Launch "Automation Test Job" (I have not tried publishing and testing that way but I assume it would work similarly)
----------- Job Status: Failed-------------
--------------- Output ----------------
Exception : Cannot process argument transformation on parameter 'DateExample'.
Cannot convert value "(Get-Date)" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
Launch the Test from the portal. For me, the runbook executed successfully
Expected result: Runbook works from the Test job launched in VSCode as well as the portal.
Configuration
OS Information:
Edition Windows 11 Enterprise
OS build 22621.1992
Product:
Visual Studio Code
Version: 1.80.1
Language: en
Reproduction steps:
Expected result: Runbook works from the Test job launched in VSCode as well as the portal.
Configuration
OS Information: Edition Windows 11 Enterprise OS build 22621.1992
Product: Visual Studio Code Version: 1.80.1 Language: en