PowerShell Test-Path returns False when testing a network share PowerShell Test-Path returns False when testing a network share powershell powershell

PowerShell Test-Path returns False when testing a network share


I do think I found the answer with this:

Test-Path $('filesystem::\\Server\share$\install.wim')


If the Test-Path cmdlet is truly buggy, then I'd suggest using the Exists() method on the System.IO.Directory .NET class.

[System.IO.Directory]::Exists('G:\'); # This returns $true for me


To validate a UNC, use:

[bool]([System.Uri]$path).IsUnc