peass-ng/PEASS-ng · error · PlatformNotSupportedException

The operation is not supported on this version of Windows.

Error message

The operation is not supported on this version of Windows.

What it means

CreateSymbolicLinkCore throws PlatformNotSupportedException when the OS is older than Windows Vista (Win32 error ERROR_OLD_WIN_VERSION). Symbolic link creation requires APIs (CreateSymbolicLink) that only exist on Vista+, so AlphaFS blocks execution before calling native code. This is an OS-capability gate, not a data error.

Source

Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/File Class/File Core Methods/File.CreateSymbolicLinkCore.cs:54

      /// <para>When creating a symbolic link, the operating system does not check to see if the target exists.</para>
      /// <para>Symbolic links are reparse points.</para>
      /// <para>There is a maximum of 31 reparse points (and therefore symbolic links) allowed in a particular path.</para>
      /// <para>See <see cref="Security.Privilege.CreateSymbolicLink"/> to run this method in an elevated state.</para>
      /// </remarks>
      /// <exception cref="ArgumentException"/>
      /// <exception cref="ArgumentNullException"/>
      /// <exception cref="IOException"/>
      /// <exception cref="PlatformNotSupportedException">The operating system is older than Windows Vista.</exception>
      /// <param name="transaction">The transaction.</param>
      /// <param name="symlinkFileName">The name of the target for the symbolic link to be created.</param>
      /// <param name="targetFileName">The symbolic link to be created.</param>
      /// <param name="targetType">Indicates whether the link target, <paramref name="targetFileName"/>, is a file or directory.</param>
      /// <param name="pathFormat">Indicates the format of the path parameter(s).</param>
      [SecurityCritical]
      internal static void CreateSymbolicLinkCore(KernelTransaction transaction, string symlinkFileName, string targetFileName, SymbolicLinkTarget targetType, PathFormat pathFormat)
      {
         if (!NativeMethods.IsAtLeastWindowsVista)
            throw new PlatformNotSupportedException(new Win32Exception((int) Win32Errors.ERROR_OLD_WIN_VERSION).Message);


         if (pathFormat != PathFormat.LongFullPath)
         {
            const GetFullPathOptions options = GetFullPathOptions.RemoveTrailingDirectorySeparator | GetFullPathOptions.FullCheck;

            symlinkFileName = Path.GetExtendedLengthPathCore(transaction, symlinkFileName, pathFormat, options);
            targetFileName = Path.GetExtendedLengthPathCore(transaction, targetFileName, pathFormat, options);
         }


         // Don't use long path notation, as it will be empty upon creation.
         targetFileName = Path.GetRegularPathCore(targetFileName, GetFullPathOptions.None, false);


         if (targetType == SymbolicLinkTarget.Directory)
         {
            ThrowIOExceptionIfFsoExist(transaction, false, targetFileName, pathFormat);

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Run the application on Windows Vista or later
  2. Check NativeMethods.IsAtLeastWindowsVista (or Environment.OSVersion) before calling CreateSymbolicLink and use an alternative (e.g. hardlink/junction or copy)
  3. Wrap the call in try-catch for PlatformNotSupportedException and degrade gracefully

Example fix

// before
File.CreateSymbolicLink(linkPath, targetPath, SymbolicLinkTarget.File);
// after
if (NativeMethods.IsAtLeastWindowsVista)
    File.CreateSymbolicLink(linkPath, targetPath, SymbolicLinkTarget.File);
else
    File.Copy(targetPath, linkPath); // fallback on legacy OS
Defensive patterns

Strategy: validation

Validate before calling

if (!NativeMethods.IsAtLeastWindowsVista) throw/return; // or Environment.OSVersion.Version.Major >= 6

Type guard

bool SupportsSymbolicLinks => Environment.OSVersion.Version.Major >= 6;

Try / catch

try { File.CreateSymbolicLink(link, target, SymbolicLinkTarget.File); }
catch (PlatformNotSupportedException ex) { Log(ex.Message); UseCopyFallback(); }

Prevention

When it happens

Trigger: Calling File.CreateSymbolicLink or File.CreateSymbolicLinkTransacted on Windows XP/Server 2003 or a non-Windows/restricted environment where NativeMethods.IsAtLeastWindowsVista is false.

Common situations: Running winPEAS/AlphaFS-based tooling on legacy Windows XP images, embedded/industrial boxes, or under a compatibility shim that reports an old version.

Related errors


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