Modify a trigger in a scheduled task

Welcome Forums General PowerShell Q&A Modify a trigger in a scheduled task

Viewing 4 reply threads
  • Author
    Posts
    • #198851
      Participant
      Topics: 1
      Replies: 2
      Points: -4
      Rank: Member

      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

    • #198857
      Participant
      Topics: 4
      Replies: 1908
      Points: 4,259
      Helping Hand
      Rank: Community Hero

      Are you sure about the path of the scheduled task?

    • #198878
      Participant
      Topics: 1
      Replies: 2
      Points: -4
      Rank: Member

      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.

    • #198890
      Participant
      Topics: 4
      Replies: 1908
      Points: 4,259
      Helping Hand
      Rank: Community Hero

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

      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
    • #198893
      Participant
      Topics: 1
      Replies: 2
      Points: -4
      Rank: Member

      Hi Olaf,

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

       

      Thkx,

      MRON

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.