Skip to content

WSMan provider throws exception for non-existent path with -PathType Container #11278

Closed

Description

@heaths

Steps to reproduce

test-path wsman:\foo -pathtype container

Expected behavior

The command returns $false.

Actual behavior

Exception is thrown: "Test-Path: Value cannot be null. (Parameter 'value')":

image

The $Error[1].Exception.InnerException.InnerException.StackTrace (since $Error[0] is the error for Invoke) shows:

   at System.String.StartsWith(String value, StringComparison comparisonType)
   at Microsoft.WSMan.Management.WSManConfigProvider.NormalizePath(String path, String host)
   at Microsoft.WSMan.Management.WSManConfigProvider.IsItemContainer(String path)
   at System.Management.Automation.SessionStateInternal.IsItemContainer(CmdletProvider providerInstance, String path, CmdletProviderContext context)

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, ...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    Issue-Question
    on Dec 6, 2019
  2. heaths commented on Dec 6, 2019

    @heaths
    ContributorAuthor

    It's worth pointing out that test-path wsman:\foo -pathtype leaf succeeds (i.e. returns $false instead of throwing).

  3. added
    Issue-Bug
    and removed
    Issue-Question
    on Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions