Method "NewTriggerByOnce" not found, TaskScheduler

Welcome Forums General PowerShell Q&A Method "NewTriggerByOnce" not found, TaskScheduler

This topic contains 4 replies, has 4 voices, and was last updated by

3 years ago.

  • Author
  • #33817

    Topics: 3
    Replies: 3
    Points: 1
    Rank: Member

    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

    Topics: 13
    Replies: 4872
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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

    Topics: 12
    Replies: 68
    Points: 9
    Rank: Member

    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

    Topics: 3
    Replies: 3
    Points: 1
    Rank: Member

    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

    Topics: 0
    Replies: 1
    Points: 0
    Rank: Member

    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.

The topic ‘Method "NewTriggerByOnce" not found, TaskScheduler’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort