peass-ng/PEASS-ng · error · InvalidOperationException

The current version of the native library (1.{osLibMinorVer}

Error message

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.

What it means

When reading a task's XML definition, the library computes the minimum Task Scheduler version the definition requires. If that required minor version exceeds what the local native library (1.{osLibMinorVer}) supports and throwError is set, it throws InvalidOperationException — typically when enumerating tasks created on a newer Windows version from a down-level client (e.g. Win7 reading Win10 tasks).

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs:1635

                        !dd.Contains("Source") &&
                        !dd.Contains("URI") &&
                        !dd.Contains("AllowStartOnDemand", "true", true) &&
                        !dd.Contains("AllowHardTerminate", "true", true) &&
                        !dd.Contains("MultipleInstancesPolicy", "IgnoreNew", true) &&
                        !dd.Contains("NetworkSettings") &&
                        !dd.Contains("StartWhenAvailable", "false", true) &&
                        !dd.Contains("SendEmail") &&
                        !dd.Contains("ShowMessage") &&
                        !dd.Contains("ComHandler") &&
                        !dd.Contains("EventTrigger") &&
                        !dd.Contains("SessionStateChangeTrigger") &&
                        !dd.Contains("RegistrationTrigger") &&
                        !dd.Contains("RestartOnFailure") &&
                        !dd.Contains("LogonType", "None", true))
                        newMinor = 1;

                    if (newMinor > osLibMinorVer && throwError)
                        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.");

                    if (newMinor != xmlVer.Minor)
                    {
                        dd.Version = new Version(1, newMinor);
                        var def = svc.v2TaskService.NewTask(0);
                        def.XmlText = dd.Xml;
                        return def;
                    }
                }
                return iTask.Definition;
            }
            catch (COMException comEx)
            {
                if (throwError)
                {
                    if ((uint)comEx.ErrorCode == 0x80041318 && xmlVer.Minor != osLibMinorVer) // Incorrect XML value
                        throw new InvalidOperationException($"The current version of the native library (1.{osLibMinorVer}) does not support the version of the \"{iTask.Name}\" task ({xmlVer})");
                    throw;

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Run the enumeration from a client OS at least as new as the machine that registered the tasks
  2. Use TaskService.Connect with matching OS versions, or upgrade the client to Windows 10+
  3. Set throwError=false to skip/adjust unsupported tasks instead of throwing
  4. Downgrade the offending task's XML version manually (the library attempts to trim unsupported features)

Example fix

// before
foreach (var t in remoteFolder.Tasks) Console.WriteLine(t.Definition.XmlText);
// after
foreach (var t in remoteFolder.GetTasks(throwError: false))
    Console.WriteLine(t.Definition.XmlText);
Defensive patterns

Strategy: try-catch

Validate before calling

if (newMinor > osLibMinorVer)
    Console.WriteLine($"Task {taskName} requires v1.{newMinor}; local library supports 1.{osLibMinorVer}");

Try / catch

try { EnumerateTasks(folder); }
catch (InvalidOperationException ex) when (ex.Message.Contains("native library"))
{ /* skip task or re-run from a newer client */ }

Prevention

When it happens

Trigger: Enumerating/connecting to a task store whose tasks were registered with features newer than the client's native library supports; a task XML requiring version 1.{newMinor} while the client is 1.{osLibMinorVer} with newMinor > osLibMinorVer.

Common situations: Remote task enumeration from an older OS to a newer one (Win7 client → Win10 server); tasks using newer triggers/settings unavailable in older Task Scheduler; migrating task definitions between machines.

Related errors


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/089b9758ab209401. Report an issue: GitHub.