Skip to content

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

@heaths

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the product

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions