dsccommunity / dsccommunity/ComputerManagementDsc
xScheduledTask can't disable default ScheduledDefrag task
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 338
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
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```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the xScheduledTask configuration for the ScheduledDefrag task and trace MSFT_xScheduledTask Test-TargetResource where the "Trigger type not recognized" error is reported. Confirm how the existing ScheduledDefrag trigger is represented, then verify that setting Enable to $false with ScheduleType 'Once' completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- devops, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100