diff --git a/filer-manager.ps1 b/filer-manager.ps1 index 05e5e20..f830368 100644 --- a/filer-manager.ps1 +++ b/filer-manager.ps1 @@ -782,8 +782,16 @@ function Invoke-FilerScan { # Canonicalise the root once. Every child path is derived from this # string, and every length compared against -MaxPathLength is measured on # it, so an 8.3 alias here would understate how long the real paths are. + # ProviderPath, not Path: on a UNC root the latter comes back in + # provider-qualified form ("Microsoft.PowerShell.Core\FileSystem::\\srv\ + # share"), which no Win32 call can open - the scan then found nothing. $fullPath = $p - try { $fullPath = (Resolve-Path -LiteralPath $p).Path } catch { } + try { + $rp = Resolve-Path -LiteralPath $p -ErrorAction Stop + $cand = [string]$rp.ProviderPath + if ([string]::IsNullOrWhiteSpace($cand)) { $cand = [string]$rp.Path } + if ($cand) { $fullPath = $cand } + } catch { } $fullPath = Expand-FilerShortPath -Path $fullPath $node = Get-FolderNode -Path $fullPath -MaxLen $MaxPathLength ` -LongPaths $longPaths -ScanErrors $scanErrors -Progress $Progress