PowerShell Test-Path returns False when testing a network share

前端 未结 6 1453
余生分开走
余生分开走 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条回答
  •  梦毁少年i
    2021-01-05 03:25

    For me the only way to fix it was to use the full UNC, rather than the share name.

    So instead of \\server\share I used \\server\c$\sharedir.

    Another issue I ran into was when using Import-Module sqlps, I had to make sure to CD back into the file system and then the PowerShell commands worked normally.

提交回复
热议问题