我正在尝试使用 PowerShell 创建一个新的计划任务,但我无法更改其中一个属性:Repetition Property CimInstance#Instance Repetition {get;set;}
$action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-c test.ps1"
$trigger = New-ScheduledTaskTrigger -daily -at 10am -DaysInterval 1
$trigger.DaysInterval = (New-TimeSpan -hours 1)
$trigger.enabled = $true
$trigger.Repetition = (New-TimeSpan -Days 1) #Failing with error
.....
Exception setting "Repetition": "The adapter cannot set the value of property "Repetition"."
At line:1 char:1
+ $trigger.Repetition = 1
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : CatchFromBaseAdapterSetValue
是否有任何相关的参数New-ScheduledTaskAction
可以用来通过 cmdlet 更改这些属性?