{"record":{"id":"cd4740993fb16c16","repo":"peass-ng/PEASS-ng","slug":"only-a-single-week-can-be-set-with-task-scheduler","errorCode":null,"errorMessage":"Only a single week can be set with Task Scheduler 1.0.","messagePattern":"Only a single week can be set with Task Scheduler 1\\.0\\.","errorType":"exception","errorClass":"NotV1SupportedException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/V1/TaskSchedulerV1Interop.cs","lineNumber":233,"sourceCode":"    internal struct MonthlyDOW\n    {\n        public ushort WhichWeek;\n        public DaysOfTheWeek DaysOfTheWeek;\n        public MonthsOfTheYear Months;\n\n        public WhichWeek V2WhichWeek\n        {\n            get\n            {\n                return (WhichWeek)(1 << ((short)WhichWeek - 1));\n            }\n            set\n            {\n                int idx = Array.IndexOf(new short[] { 0x1, 0x2, 0x4, 0x8, 0x10 }, (short)value);\n                if (idx >= 0)\n                    WhichWeek = (ushort)(idx + 1);\n                else\n                    throw new NotV1SupportedException(\"Only a single week can be set with Task Scheduler 1.0.\");\n            }\n        }\n    }\n\n    [StructLayout(LayoutKind.Explicit)]\n    internal struct TriggerTypeData\n    {\n        [FieldOffset(0)]\n        public Daily daily;\n        [FieldOffset(0)]\n        public Weekly weekly;\n        [FieldOffset(0)]\n        public MonthlyDate monthlyDate;\n        [FieldOffset(0)]\n        public MonthlyDOW monthlyDOW;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/V1/TaskSchedulerV1Interop.cs#L215-L251","documentation":"Interop guard in the V1 MONTHLYDOW struct's V2WhichWeek setter: Task Scheduler 1.0 can store only a single week selector, so the incoming WhichWeek flags mask is matched against the single-bit values {0x1,0x2,0x4,0x8,0x10}; any combined mask (multiple bits) or out-of-range value finds no match (Array.IndexOf returns -1) and NotV1SupportedException is thrown. The faulting input is the value being assigned.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/V1/TaskSchedulerV1Interop.cs:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign only one of the single week flags (First..FourthWeek or LastWeek equivalents 0x1-0x10) when running against Task Scheduler 1.0","Split tasks into separate registrations, one per selected week, if multiple weeks are needed on V1","Use Task Scheduler 2.0+, whose monthly-DOW trigger supports combined week masks"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}