Access to a UNC path

Gloops 41 Reputation points
2021-02-22T14:49:26.52+00:00

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.
5,362 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Gloops 41 Reputation points
    2021-02-22T15:51:41.253+00:00

    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";
    }
    else{
    "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
    2021-02-23T21:24:46.357+00:00

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

    0 comments No comments

  3. Andreas Baumgarten 96,281 Reputation points MVP
    2021-02-23T21:39:22.317+00:00

    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)

    Regards
    Andreas Baumgarten

    0 comments No comments

  4. AliceYang-MSFT 2,081 Reputation points
    2021-02-25T09:15:42.807+00:00

    Hi,

    I know little about PowerShell but hope these links are helpful.
    UNC paths
    2.2.1.3 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.