Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

New-PSDrive -Persist should report a platform-not-supported error (System.PlatformNotSupportedException) on Unix-like platforms #8250

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Using New-PSDrive -Persist, i.e. creating a persistent drive mapping at the OS level, is only supported on Windows.

While trying to use it on Unix-like platforms does report an error, the error message is confusing (see below).

Steps to reproduce

New-PSDrive -root '\\foo\bar\' -name N  -PSProvider filesystem  -Persist

Expected behavior

The error message should indicate that the host platform is not supported, along the lines of System.PlatformNotSupportedException

Actual behavior

The following error is reported:

New-PSDrive : When you use the Persist parameter,
              the root must be a file system location on a remote computer.

The reason is that the code currently blindly follows a Windows code path until it eventually hits the PathIsNetworkPath() method in FileSystemProvider.cs, which categorically returns false on Unix.

Environment data

PowerShell Core 6.2.0-preview.1 on macOS 10.14
PowerShell Core 6.2.0-preview.1 on Ubuntu 16.04.5 LTS
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.