I'm trying to test if a UNC path exists, but all attempts have failed so far. This folder example exists, and returns true:
\\Server\Path1
I'd like to confirm all folders with similar names exist, such as:
\\Server\Path2 \\Server\Path3 etc.
I've tried using a wildcard in these examples:
test-path "\\Server\Path*"
resolve-path "\\Server\Path*"
[System.IO.Directory]::Exists('\\Server\Path*');
Test-Path $('filesystem::\\Server\Path*')
...Along with many permutations of the \ " ' * combination.
However, nothing I've tried returns a 'True' for this type of path when using a wildcard, even though it seems to work fine for: Test-Path c:\windows\system3*
for example.
I don't think Windows supports wildcard selection on share names.
But if you have sufficient (remote) access to the file server you can get a list of shares: