Access to a UNC path

Gloops 41 Reputation points

Hello everybody,

When I access to a path as a UNC path, and I need it as the current directory, is it mandatory to provide it a driver letter ?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,895 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Gloops 41 Reputation points

    Sorry I later realized that the used platform was not made obvious by the name of the forum : it is Powershell.

    My script looks like this :

    $source = Get-ChildItem "\Uc00006\d\Projets Visual Studio\Web"

    foreach($d in $source)
    $N = $d.Name;
    $path = "D:\Projects Visual Studio\web\" + $N;
    if((Test-Path $path)-eq $true){
    $N + " OK";
    "not found : " + $N;

    This version does not work (to Copy-Item), it was OK when I used SUBST to initialize the default path.

  2. Gloops 41 Reputation points

    Does Test-Path test for sub-directories ?
    Shall have a look tomorrow.

    0 comments No comments

  3. Andreas Baumgarten 68,311 Reputation points MVP

    Hi @Gloops ,

    Test-Path c:\Junk\*  

    Gives a false if empty.
    Gives a true if a file or a folder is in Junk


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Andreas Baumgarten

    0 comments No comments

  4. AliceYang-MSFT 2,071 Reputation points


    I know little about PowerShell but hope these links are helpful.
    UNC paths UNC Path
    2.2.57 UNC


    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.