New-Item -ItemType HardLink -Path C:\ -Name cdl.txt -Value C:\ComponentDetectionLog.txt
gci | ? { $_.LinkType } | Select FullName, LinkType, Target
Target array returns all linked files.
Target array is empty on Windows PWSH 6.2.3
PS c:> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.18362.145
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.145
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS c:> gci | ? { $_.LinkType } | Select FullName, LinkType, Target
FullName LinkType Target
-------- -------- ------
C:\cdl.txt HardLink {C:\ComponentDetectionLog.txt}
C:\ComponentDetectionLog.txt HardLink {C:\cdl.txt}
Powershell Core
c:> gci | ? { $_.LinkType } | Select FullName, LinkType, Target
FullName LinkType Target
-------- -------- ------
C:\cdl.txt HardLink {}
C:\ComponentDetectionLog.txt HardLink {}
C:> $PSVersionTable
Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
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
Steps to reproduce
Expected behavior
Actual behavior
Environment data