Skip to content

xScheduledTask can't disable default ScheduledDefrag task #137

@RobBiddle

Description

@RobBiddle

I'm using xComputerManagement 3.2.0.0, attempting to disable the default task ScheduledDefrag

I've tried populating all of the current values for the task, only changing Enable to $false and ScheduleType to 'Once'.

Here is the configuration and error thrown:

        {
            ActionArguments                 = '-c -h -k -g -$'
            ActionExecutable                = '%windir%\system32\defrag.exe'
            AllowStartIfOnBatteries         = $false
            Compatibility                   = 'Win8'
            Description                     = 'This task optimizes local storage drives.'
            DisallowDemandStart             = $false
            DisallowHardTerminate           = $false
            DisallowStartOnRemoteAppSession = $false
            DontStopIfGoingOnBatteries      = $false
            DontStopOnIdleEnd               = $false
            Enable                          = $false
            Ensure                          = 'Present'
            ExecutionTimeLimit              = '3.00:00:00'
            Hidden                          = $false
            IdleDuration                    = '00:00:00'
            IdleWaitTimeout                 = '00:00:00'
            LogonType                       = 'ServiceAccount'
            MultipleInstances               = 'IgnoreNew'
            Priority                        = '7'
            RandomDelay                     = '00:00:00'
            RepeatInterval                  = '00:00:00'
            RepetitionDuration              = 'Indefinitely'
            RestartCount                    = '0'
            RestartInterval                 = '00:00:00'
            RestartOnIdle                   = $false
            RunLevel                        = 'Highest'
            RunOnlyIfIdle                   = $false
            RunOnlyIfNetworkAvailable       = $false
            ScheduleType                    = 'Once'
            StartTime                       = '1/28/2018 12:00:00 AM'
            TaskName                        = 'ScheduledDefrag'
            TaskPath                        = '\Microsoft\Windows\Defrag\'
            User = 'SYSTEM'
            WakeToRun                       = $false
        }


VERBOSE: [ADM3]: LCM:  [ End    Test     ]  [[xScheduledTask]DisableScheduledDefragTask]  in 0.4430 seconds.
PowerShell DSC resource MSFT_xScheduledTask  failed to execute Test-TargetResource functionality with error message: Trigger type  not recognized.
Parameter name: CimClassName
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.duplicateThe issue or PR is the duplicate of another.in progressThe issue is being actively worked on by someone.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions