Method "NewTriggerByOnce" not found, TaskScheduler

This topic contains 4 replies, has 4 voices, and was last updated by  Randy Orrison 2 years, 2 months ago.

  • Author
  • #33817

    Andreas Öberg

    Hello! Iam pretty new in Powershell and sorry for my lousy English.

    Iam trying to add a task in Task Scheduler throu Powershell, here is the Code so far.

    $Action = New-ScheduledTaskAction -Execute "C:\BackupScript\CopyFiles.ps1"
    $Trigger = New-ScheduledTaskTrigger -Daily -At '11AM'
    $Principal = New-ScheduledTaskPrincipal -UserId $env:username -RunLevel Highest
    $Settings  = New-ScheduledTaskSettingsSet -RunOnlyIfNetworkAvailable -WakeToRun
    $Task = New-ScheduledTask -Action $Action -Trigger $Trigger -Principal $Principal -Settings $Settings
    $Task | Register-ScheduledTask -TaskName 'AndreasBackup'

    When running the cmdlet New-ScheduledTaskTrigger (Line 2), I get the following error:

    "New-ScheduledTaskTrigger : Method "NewTriggerByDaily" not found
    At line:2 char:12
    + $Trigger = New-ScheduledTaskTrigger -Daily -At '11AM'
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [New-ScheduledTaskTrigger], CimExc
    + FullyQualifiedErrorId : HRESULT 0x80041002,New-ScheduledTaskTrigger"

    No matter how I try, I can't get that cmdlet to work.. Not even with the examples from

    Iam running PS version 5, build 10586 on my Windows 10 machine.

    Any ideas?

  • #33828

    Don Jones

    It sounds like something is screwed up on your machine, because I'm not able to reproduce the error. Unfortunately, I'm not sure what to look for, here. Do you have another machine you can test on?

  • #33997

    David Jones

    I have the same issue. it seems to be only machines that were upgraded from 8.1 to win10 then upgraded to 1511. (every machine I have)
    a fresh install of 1511 does not have the issue.

  • #34036

    Andreas Öberg

    Hello, and sorry for the late answer.. I have been testing on some other Windows 10 machines aswell, but still unable to run the script.

    Instead I used the new set of cmdlets released in Powershell version 5. Now It looks something like this:

    $Trigger = New-JobTrigger -Daily -At 1:21PM
    $Options = New-ScheduledJobOption -WakeToRun -RequireNetwork
     Register-ScheduledJob -Name "AndreasJob" {C:\BackupScript\CopyFiles.ps1} -Trigger $trigger -ScheduledJobOption $options

    Here is the link to what's new in Powershell Version 5.

  • #39917

    Randy Orrison

    I had a similar problem with New-ScheduledTaskTrigger -Daily giving the error "NewTriggerByDaily" not found. Some more Googling found a thread on with the answer:

    PS C:\> mofcomp C:\Windows\System32\wbem\SchedProv.mof

    New-ScheduledTaskTrigger now works correctly.

You must be logged in to reply to this topic.