X Tutup
Skip to content

.LinkType and .Target properties of System.IO.DirectoryInfo instances do not correctly reflect system-defined junctions #7127

@mklement0

Description

@mklement0

Windows Vista defined (hidden) junctions (essentially, symbolic links to directories) to redirect legacy folder paths to their modern paths; e.g, "$HOME/Cookies", "$HOME/My Documents".

The .LinkType property of such paths, as returned by Get-Item / Get-ChildItem should contain string 'Junction', but it is currently $null.

Similarly, the .Target property (the link/junctions's target path) unexpectedly contains $null.

Note that these junctions also have the Hidden and System attributes set (in addition to ReparsePoint).

However, even manually recreating a junction with all these attributes set does not reproduce the problem.

Steps to reproduce

Get-Item -Force $HOME/Cookies | Select Mode, LinkType

Expected behavior

Mode   LinkType
----   --------
d--hsl Junction

Actual behavior

Mode   LinkType
----   --------
d--hsl 

Note how the LinkType value is missing.

You can verify that the target path is a junction as follows:
cmd /c dir /aL $HOME | sls Cookies

Environment data

PowerShell Core v6.1.0-preview.3 on Microsoft Windows 10 Pro (64-bit; Version 1709, OS Build: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup