{"record":{"id":"72d9ebb5b02185ae","repo":"peass-ng/PEASS-ng","slug":"the-current-version-of-the-native-library-1-osli-72d9eb","errorCode":null,"errorMessage":"The current version of the native library (1.{osLibMinorVer}) does not support the version of the \"{iTask.Name}\" task ({xmlVer})","messagePattern":"The current version of the native library \\(1\\.(.+?)\\) does not support the version of the \"(.+?)\" task \\((.+?)\\)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs","lineNumber":1652,"sourceCode":"                    if (newMinor > osLibMinorVer && throwError)\n                        throw new InvalidOperationException($\"The current version of the native library (1.{osLibMinorVer}) does not support the original or minimum version of the \\\"{iTask.Name}\\\" task ({xmlVer}/1.{newMinor}). This is likely due to attempting to read the remote tasks of a newer version of Windows from a down-level client.\");\n\n                    if (newMinor != xmlVer.Minor)\n                    {\n                        dd.Version = new Version(1, newMinor);\n                        var def = svc.v2TaskService.NewTask(0);\n                        def.XmlText = dd.Xml;\n                        return def;\n                    }\n                }\n                return iTask.Definition;\n            }\n            catch (COMException comEx)\n            {\n                if (throwError)\n                {\n                    if ((uint)comEx.ErrorCode == 0x80041318 && xmlVer.Minor != osLibMinorVer) // Incorrect XML value\n                        throw new InvalidOperationException($\"The current version of the native library (1.{osLibMinorVer}) does not support the version of the \\\"{iTask.Name}\\\" task ({xmlVer})\");\n                    throw;\n                }\n            }\n            catch\n            {\n                if (throwError)\n                    throw;\n            }\n            return null;\n        }\n\n        internal static ITaskDefinition GetV2StrippedDefinition(TaskService svc, IRegisteredTask iTask)\n        {\n            try\n            {\n                var dd = new DefDoc(iTask.Xml);\n                var xmlVer = dd.Version;\n                if (xmlVer.Minor > osLibMinorVer)","sourceCodeStart":1634,"sourceCodeEnd":1670,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs#L1634-L1670","documentation":"When registering/validating task XML, a COMException with HRESULT 0x80041318 (SCHED_E_INVALIDVALUE — incorrect XML value) that is not resolvable by downgrading the version causes this InvalidOperationException when throwError is true. It means the task's XML declares a version the local native library cannot represent.","triggerScenarios":"Calling DefinitionalUpdate/Register or reading a task whose XML version (xmlVer) has a minor version different from the local library's (osLibMinorVer), producing COM error 0x80041318, with throwError enabled.","commonSituations":"Importing task XML exported from a newer Windows version; copying .xml task definitions between machines with different Task Scheduler versions; programmatic XML edits that alter the version attribute.","solutions":["Ensure the XML's <Task version=\"1.x\"> attribute matches a version the local OS supports","Re-export the task XML from an OS with the same Task Scheduler version","Set throwError=false to tolerate the mismatch (library will attempt adjustment)","Edit the XML manually to lower the version and remove unsupported elements"],"exampleFix":"// before\nfolder.RegisterTaskDocument(name, xmlFromWin10Machine, throwError: true);\n// after\nvar xml = xmlFromWin10Machine.Replace(\"version=\\\"1.6\\\"\", \"version=\\\"1.4\\\"\");\nfolder.RegisterTaskDocument(name, xml, throwError: true);","handlingStrategy":"try-catch","validationCode":"var m = Regex.Match(xml, \"<Task[^>]*version=\\\"1\\.(\\\\d+)\\\"\");\nif (m.Success && int.Parse(m.Groups[1].Value) > osLibMinorVer)\n    Console.WriteLine(\"XML version too new for this machine\");","typeGuard":null,"tryCatchPattern":"try { folder.RegisterTaskDocument(name, xml, throwError: true); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"does not support the version\"))\n{ /* lower xml version or re-export on matching OS */ }","preventionTips":["Re-export task XML on an OS with the same Task Scheduler version","Validate the <Task version> attribute against the local library before importing"],"tags":["taskscheduler","version-mismatch","xml","comexception"],"backgroundTag":"scheduler-version-mismatch","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}