如何使用Powershell修改现有的计划任务?
我正在使用一些发布自动化脚本,使用Powershell来更新执行各种应用程序的现有计划任务。 在我的脚本中,我可以设置应用程序的path和工作目录,但似乎没有将更改保存回任务。 function CreateOrUpdateTaskRunner { param ( [Parameter(Mandatory = $TRUE, Position = 1)][string]$PackageName, [Parameter(Mandatory = $TRUE, Position = 2)][Version]$Version, [Parameter(Mandatory = $TRUE, Position = 3)][string]$ReleaseDirectory ) $taskScheduler = New-Object -ComObject Schedule.Service $taskScheduler.Connect("localhost") $taskFolder = $taskScheduler.GetFolder('\') foreach ($task in $taskFolder.GetTasks(0)) { # Check each action to see if it references the current package foreach ($action in […]