Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNC Paths do not support paths over 255 characters #6049

Closed
SotoDucani opened this issue Jan 27, 2018 · 3 comments
Closed

UNC Paths do not support paths over 255 characters #6049

SotoDucani opened this issue Jan 27, 2018 · 3 comments
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-Duplicate The issue is a duplicate.

Comments

@SotoDucani
Copy link

So this is something I've experienced while attempting to use Core to solve a User Profile archiving problem that's been a thorn in our side when users have paths that exceed the usual 255 character limit. Through some experimentation I've found that long path support works perfectly as long as you are local or working through a mapped drive, but it does not work through UNC Paths.

Very well could be associated with #4439 or other long path issues that are currently open, but none of them directly mention UNC paths or seem like they should be closed at this point. Figured I'd put this in anyways just to check.

Seems to not work regardless of if you are trying to copy Remote > Remote or Remote > Local. Accessing a Share vs Admin Share also does not matter.

Steps to reproduce

#On the "Remote" machine do some setup of the test files
$aName = "a"*255
Set-Location C:\Users\Test\Documents
New-Item -Type Directory -Name $aName
Get-Process | Out-File -Path "C:\Users\Test\Documents\$aName\LongFile.txt"

#On the 'local' machine that you are trying to move/copy files with
$aName = "a"*255
Copy-Item -Path \\ComputerName\C$\Users\Documents\$aName\ -Destination C:\Users\Test2\Documents\CopyTarget -Recurse -Force

Expected behavior

Files from the UNC Path are copied to the CopyTarget folder

Actual behavior

No files are copied over and the command errors out on the path that exceeds 255 characters. If there are other folders and files that do not exceed 255 character paths, they will successfully be copied.

Copy-Item : Cannot find path '\\ComputerName\C$\Users\Test\Documents\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\' because it does not e
xist.
At line:1 char:1
+ Copy-Item -Path "\\ComputerName\C$\Users\Test\Documents\$ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\ComputerName...aaaaaaaaaaaaaa\:String) [Copy-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0
PSEdition                      Core
GitCommitId                    v6.0.0
OS                             Microsoft Windows 6.1.7601 S
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@iSazonov
Copy link
Collaborator

Your report is for Windows 7. Long path support was introduced in Windows 10. You should set LongPathsEnabled in Registry.

@iSazonov iSazonov added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Jan 27, 2018
@SotoDucani
Copy link
Author

SotoDucani commented Jan 27, 2018

Could you help me understand why the local paths (C:\ or mapped drives)that are still over 255 characters work as expected in the same kind of test then? I don't know nearly enough about the inner workings of Core to make an educated guess and would appreciate the info!

I've also just duplicated the behavior on my Win 10 machine after setting that reg key. I feel like I'm missing something here.

@iSazonov
Copy link
Collaborator

It is dup #3259

@SteveL-MSFT SteveL-MSFT added the Resolution-Duplicate The issue is a duplicate. label Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-Duplicate The issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants