Modify a trigger in a scheduled task

Hi,

I was trying to change a trigger, like it shows in the Help file, but it doesn’t work, any ideas ?

Modify a trigger in a scheduled task
PS C:> $Time = New-ScheduledTaskTrigger -At 12:00 -Once
PS C:> Set-ScheduledTask –TaskName “SoftwareScan” –Trigger $Time
TaskPath TaskName


\ SoftwareScan

In this example, the first command uses the New-ScheduledTaskTrigger cmdlet to define a time trigger, to which the $Time variable is assigned.

 

Set-ScheduledTask : The system cannot find the file specified.
At line:1 char:3

  • Set-ScheduledTask -Trigger $Time -TaskName $name
  • CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/…S_ScheduledTask) [Set-ScheduledTask], CimException
  • FullyQualifiedErrorId : HRESULT 0x80070002,Set-ScheduledTask

 

 

Thx for the help.

MRON

Are you sure about the path of the scheduled task?

Hi,

 

when I create a schedule task, I don’t specify the path, but in this case, the schedule task, that I want to change is not in the default path, and I don’t know if it is the issue.

 

When I cal the taskname of the schedule task, I can get all the information.

 

Thkx.

If I remember right you will have to provide the full path of the schedlued task for the cmdlet Set-ScheduledTask. If the task is in the root you will have to provide the “” as the path … so it should look like this:

Set-ScheduledTask –TaskName "\SoftwareScan" –Trigger $Time

Hi Olaf,

thank you very much for the help, like you said, it was the “/” that was missing.

 

Thkx,

MRON