What version of MS Operating Systems support the long file path feature \\?\

I am trying to read in file names that have paths longer than 266 characters.  So, I'm using \\?\ as a pre-pend to the file name.

This works great on my Windows 10 machine, but when I try to run it (using PowerShell v. 4) on a Windows Server 2012 R2 Datacenter machine (Windows version 6.3.9600), I get error messages leading me to assume that the feature is not supported.

Here's my actual PowerShell code to test this.  Again, this works fine on my Win10 desktop, but not the server:
$sFileName = "\\?\H:\COMMUNITY\Compliance\AQIP\2010 Systems Portfolio\Systems Portfolio Draft orig (Autosaved).docx"
$objFileStream = New-Object IO.FileStream($sFileName,[System.IO.FileMode]::Open)

The error I get is:
New-Object : Exception calling ".ctor" with "2" argument(s): "Illegal characters in path."
At H:\Information Technology\InstallFilesOld\OtherPSScripts\Test.ps1:2 char:18
+ $objFileStream = New-Object IO.FileStream("\\?\$($sFileName)",[System.IO.FileMod ...
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

If I run the code without the \\?\ (using the following code), I don't get any errors.
$sFileName = "H:\COMMUNITY\Compliance\AQIP\2010 Systems Portfolio\Systems Portfolio Draft orig (Autosaved).docx"
$objFileStream = New-Object IO.FileStream($sFileName,[System.IO.FileMode]::Open)
malcolm29Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
This is actually a .NET Framworks issue. .NET 4.6.2 is what enables this functionality. More info:
https://blogs.msdn.microsoft.com/jeremykuhne/2016/06/21/more-on-new-net-path-handling/

Make sure you have .NET 4.6.2 or newer installed and then test out your code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
malcolm29Author Commented:
Great!  Thanks, Jeremy!  Greg.
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to help. :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.