Test-Path Question

This topic contains 2 replies, has 2 voices, and was last updated by  Kawika Moss 3 years, 3 months ago.

  • Author
  • #24231

    Kawika Moss

    I'm attempting to test the Test-Path cmdlet on a path that I already know exists, as such:

    Test-Path "\\server1\engineering_store\H11824\case2_Case_Files\Nuix\simpleCases\H11824_2\InUse"

    And it keeps returning false...Why?


  • #24237

    Simon Wåhlin

    If you currently are in a location that is not using the filesystem drive, testing UNC-paths fails. To work around this, either use Set-Location -Path $Env:SystemDrive first or prepend filesystem:: to your path to tell test-path which psprovider to use, like this:

    Test-Path -Path "filesystem::\\server1\engineering_store"

  • #24263

    Kawika Moss

    That's was great!! Thanks

You must be logged in to reply to this topic.