Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PS7: Get-Item and Get-ChildItem slow on UNC paths because it enumerates parent directories #12795

Copy link
Copy link
@jgard

Description

@jgard
Issue body actions

Enterprise environment, have a central file server with home drives for each employee (~4,000). Each employee has a path like \\SERVER.DOMAIN.COM\share\home\EMPLOYEEID, and also has it mapped to H:\.

In Powershell 7.01, cmdlets like Get-Item and Get-ChildItem take far longer to run against the UNC path than the corresponding mapped drive path. Powershell 6.x and 5.1 do not exhibit this.

Tools like Wireshark and Process Monitor suggest that pwsh is traversing the path, getting a full directory list at each level. For example, if I run Get-Item \\SERVER.DOMAIN.COM\share\home\MYID\folder, I will see in Wireshark all employee ID folder names in packet data as it enumerates at the \\SERVER.DOMAIN.COM\share\home level.

Steps to reproduce

Get-Item \\SERVER.DOMAIN.COM\share\home\MYID\folder  #Slow
Get-Item H:\folder  #Fast

Expected behavior

#Only perform the necessary SMB request.  Do not enumerate parent folders
Get-Item \\SERVER.DOMAIN.COM\share\home\MYID\folder

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.1
PSEdition                      Core
GitCommitId                    7.0.1
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Also have PS6 and PS5 installed.
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performancecore PowerShell engine, interpreter, and runtime performanceWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.