PowerShell Test-Path returns False when testing a network share

前端 未结 6 1429
余生分开走
余生分开走 2021-01-05 03:00

The user has appropriate permissions to read the share, and the share maps properly. This issue seems to happen only in PowerShell v2.0.

If I remove all mapped drive

6条回答
  •  悲&欢浪女
    2021-01-05 03:30

    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
    

提交回复
热议问题