peass-ng/PEASS-ng · error · NotV1SupportedException

NotV1SupportedException

Error message

NotV1SupportedException

What it means

TaskFolder.GetFolder resolves subfolders through the v2 (Task Scheduler 2.0) COM API. When the instance wraps only a 1.0 (XP/2003) task service, v2Folder is null and the library throws NotV1SupportedException because folder hierarchies don't exist in Task Scheduler 1.0.

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs:94

                string parentPath = System.IO.Path.GetDirectoryName(path);
                if (string.IsNullOrEmpty(parentPath))
                    return null;
                return TaskService.GetFolder(parentPath);
            }
        }

        /// <summary>
        /// Gets the path to where the folder is stored.
        /// </summary>
        [NotNull]
        public string Path => (v2Folder == null) ? rootString : v2Folder.Path;

        [NotNull]
        internal TaskFolder GetFolder([NotNull] string path)
        {
            if (v2Folder != null)
                return new TaskFolder(TaskService, v2Folder.GetFolder(path));
            throw new NotV1SupportedException();
        }

        /// <summary>
        /// Gets or sets the security descriptor of the task.
        /// </summary>
        /// <value>The security descriptor.</value>
        [Obsolete("This property will be removed in deference to the GetAccessControl, GetSecurityDescriptorSddlForm, SetAccessControl and SetSecurityDescriptorSddlForm methods.")]
        public GenericSecurityDescriptor SecurityDescriptor
        {
#pragma warning disable 0618
            get { return GetSecurityDescriptor(); }
            set { SetSecurityDescriptor(value); }
#pragma warning restore 0618
        }

        /// <summary>
        /// Gets all the subfolders in the folder.
        /// </summary>

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Check TaskService.HighestSupportedVersion / connect target OS before calling GetFolder and skip folder traversal on 1.0 systems
  2. Catch NotV1SupportedException and treat the folder tree as flat (root only) on legacy systems
  3. Only use subfolder APIs when the service is v2 (folder == null implies root on 1.0)

Example fix

// before
var sub = rootFolder.GetFolder("MyFolder");
// after
try { var sub = rootFolder.GetFolder("MyFolder"); }
catch (NotV1SupportedException) { /* Task Scheduler 1.0: no folder tree */ }
Defensive patterns

Strategy: try-catch

Validate before calling

bool v2 = TaskService.Instance.HighestSupportedVersion >= TaskService.V2_0; // or check target OS >= Vista

Try / catch

try { var f = folder.GetFolder(name); }
catch (NotV1SupportedException) { /* treat as flat/root-only on 1.0 */ }

Prevention

When it happens

Trigger: Calling taskFolder.GetFolder("sub") on a TaskFolder obtained from a TaskService connected to a Task Scheduler 1.0 system (Windows XP / Server 2003), where v2Folder == null.

Common situations: Enumeration tools like winPEAS walking task folders on XP/2003 hosts; code assuming v2 folder paths when targeting mixed Windows fleets.

Related errors


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