How can I test in PowerShell code if a folder is a junction point?
Try this:
$TargetAttributes = (Get-Item -Path $Target -Force).Attributes.ToString()
if ($TargetAttributes -match "ReparsePoint") {
if ($TargetAttributes -match "Archive") {
Write-Output ("Link to a file.")
} else {
Write-Output ("Link to a folder.")
}
} else {
Write-Output ("Normal File or Folder.")
}