Get-Item -LiteralPath: final links versus intermediate reparse points in PowerShell 7.5

Manica Moscon Advogados 0 Reputation points
2026-10-27T17:03:10.7733333+00:00

I am reviewing a hypothetical Windows FileSystem-provider metadata query using Get-Item -LiteralPath. The documentary baseline is PowerShell v7.5.0, commit 713e77f15f63bae9f23fb02045c7843ad6a8769b. This is not a report of an installed or tested runtime.

The FileSystem provider documentation describes link-related properties, but those properties alone do not establish which filesystem accesses occurred.

Could you clarify these two cases?

Final component: When the named item is a symbolic link, junction, or another reparse-point type, does Get-Item return the link’s metadata, the target’s metadata, or a mixture? Can obtaining that object implicitly access or follow the target? Please identify the types covered.

Intermediate components: For a hypothetical path such as C:\example\parent\item, where parent redirects through a reparse point but item is ordinary, how are the intermediate components resolved? Does the documented behavior cover actual path resolution, or only representation of the final item?

Please provide one primary, versioned source—either an applicable public contract or implementation evidence—with a direct URL and relevant passage. For implementation evidence, please identify the actual repository path in the commit above and distinguish FileSystem-provider behavior from work delegated to System.IO or Windows.

A partial answer covering one case, with explicit version/platform/type limits and the remaining boundary, would be useful. I am not inferring no-follow from LiteralPath or transferring Get-ChildItem/FollowSymlink behavior to Get-Item. No machine tests or universal zero-I/O guarantee are requested.

Windows for business | Windows Server | User experience | PowerShell

2 answers

Sort by: Most helpful
  1. Ronald Sabiiti 1,585 Reputation points Independent Advisor
    2026-10-27T17:53:27.48+00:00

    Hello Manica,

    In PowerShell 7.5.0, Get-Item -LiteralPath returns a FileInfo or DirectoryInfo object. Although link-related properties are available for supported reparse-point types, they do not guarantee that only the link’s metadata is accessed or that the target is never followed.

    For intermediate path components, such as a junction or directory symbolic link in C:\example\parent\item, normal Windows path resolution can follow the link to locate the final item. Using -LiteralPath does not prevent this.

    The provider’s implementation helps explain how the metadata object is created, but it does not establish a universal no-follow guarantee for every reparse-point type or filesystem operation.

    For reference:

    PowerShell 7.5.0 FileSystemProvider.cs — source at the specified commit

    FileSystem provider documentation — PowerShell 7.5

    I hope this clarifies the distinction. The key point is that the returned metadata and the filesystem operations used to resolve the path are separate considerations.

    If this information was helpful, please click Accept Answer.

    Thank you for choosing Microsoft Q&A.

    Was this answer helpful?


  2. AI answer

    2026-10-27T17:04:16.9+00:00

    For PowerShell 7.5 on Windows, Get-Item -LiteralPath represents a final linked item as a FileInfo or DirectoryInfo for the link path, but intermediate symbolic-link components are resolved by Windows as part of pathname lookup; the available sources do not establish a universal “target is never accessed” guarantee or the exact provider call path at commit 713e77f15f63bae9f23fb02045c7843ad6a8769b.

    Final path component

    The PowerShell 7.5 FileSystem-provider contract says:

    • Files are returned as System.IO.FileInfo.
    • Directories are returned as System.IO.DirectoryInfo.
    • For a linked item, Mode contains l, and LinkType identifies the link type.
    • On Windows NTFS, possible LinkType values include HardLink, SymLink, Junction, and other values.
    • AppExecLink is an explicit exception: Windows supplies neither LinkType nor LinkTarget for it. ^1^

    That establishes representation of the final named item, not a complete trace of filesystem operations. In particular:

    • LinkTarget describes “the target path of the link located in FullName”; it does not replace the returned object with an object representing the target. Its documented resolution scope is symbolic links and junctions. ^2^
    • Explicit target resolution is a separate operation, ResolveLinkTarget(bool). Passing false returns the immediate target and true follows links to the final target. That API is documented for symbolic links and junctions. ^3^

    Therefore, for symbolic links and junctions, the supported conclusion is:

    1. The returned object represents the item at the supplied link path.
    2. Link-specific properties describe that link.
    3. It is not equivalent to an explicit ResolveLinkTarget(true) operation.
    4. This does not imply zero target-related I/O. Property evaluation, filesystem filters, and reparse processing can cause additional access.

    For Windows symbolic links specifically, Windows documents that GetFileAttributes and GetFileAttributesEx return attributes for the symbolic link rather than its target. It also documents that find operations return link information, while other APIs can use the target; consequently, an object’s properties should not be generalized into a single “all metadata is link metadata” rule without identifying each underlying API. ^4^

    For other reparse-point types, no universal answer follows. Reparse data can be interpreted by a filesystem filter, and that filter may redirect, retrieve, or otherwise process the item. If the corresponding filter is unavailable, opening the item can fail. ^5^ Thus, the symbolic-link/junction conclusions must not be extended to AppExecLink, cloud placeholders, HSM, mount points, or arbitrary third-party tags without a type-specific contract.

    Intermediate path components

    For a path such as:

    Get-Item -LiteralPath 'C:\example\parent\item'
    

    if parent is a Windows symbolic link, Windows pathname resolution replaces that component with its target and appends the remaining item suffix. Microsoft’s absolute-link example changes:

    C:\alpha\beta\absLink\gamma\file
    

    into:

    \\machineB\share\gamma\file
    

    when absLink targets \\machineB\share. Relative links are handled similarly, followed by normalization of .. components. ^6^

    Accordingly, if parent redirects to C:\target, lookup of the ordinary final component proceeds logically as C:\target\item. The returned object represents item, not parent. This is Windows path resolution, not the PowerShell Extended Type System’s representation of a final linked item.

    The PowerShell provider documentation describes the objects and link properties exposed by Get-Item; it does not specify the component-by-component Windows name-resolution algorithm. -LiteralPath prevents PowerShell wildcard interpretation—it should not be treated as a no-follow filesystem-open flag.

    Source-level boundary

    The repository path for the provider is:

    src/System.Management.Automation/namespaces/FileSystemProvider.cs
    

    The available repository source identifies this as the FileSystem-provider implementation location. ^7^

    However, that URL points to master, not commit 713e77f15f63bae9f23fb02045c7843ad6a8769b. The supplied material does not contain a commit-pinned listing with the relevant GetItem symbols and calls. It therefore cannot substantiate an exact claim about whether that revision constructs FileInfo/DirectoryInfo, requests attributes, evaluates LinkTarget, or invokes another System.IO helper at a particular line.

    The defensible boundary is:

    • PowerShell 7.5 contract: final linked items are exposed as FileInfo/DirectoryInfo objects with link metadata.
    • System.IO contract: LinkTarget and ResolveLinkTarget have explicit symbolic-link/junction semantics.
    • Windows contract: intermediate symbolic-link components rewrite the path, while final-component behavior varies by the filesystem API and reparse type.
    • Not established here: the exact provider-to-System.IO call chain at the requested PowerShell commit or a universal zero-target-I/O guarantee.

    References

    1. about_FileSystem_Provider
    2. FileSystemInfo.LinkTarget Property-Definition
    3. FileSystemInfo.ResolveLinkTarget(Boolean) Method-Definition
    4. Symbolic Link Effects on File Systems Functions
    5. Reparse points
    6. Creating Symbolic Links
    7. PowerShell/src/System.Management.Automation/namespaces ... - GitHub
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.