Skip to content

Get-ChildItem of (Get-Volume) Paths does not work as expected #15872

@PowershellScripter

Description

@PowershellScripter

Prerequisites

Steps to reproduce

During the creation of a module, I run back and forth between 5.1 and pwsh (currently 7.1.3) to make sure the module will work in both versions.

While running in PWSH-7.1.3:

$ISO = 'C:\WindowsImages\Win10_21H1_English_x64.iso'
$Drive = Mount-DiskImage $ISO -StorageType ISO -NoDriveLetter -PassThru
gci -LiteralPath (Get-Volume | ?{($.DriveType -match 'CD') -and ($.Size -match $Drive.Size)}).Path -fo -re

I get back a live list of all the files found in 'C:'

Expected behavior

In powershell 5.1, I get back all the files found in:

Directory: \\?\Volume{1a1cbe60-f411-11eb-aec7-001a7dda7113}

Actual behavior

In PWSH 7.1.3, I get back all the files found in:

Directory: C:\

Error details

No Errors, I just dont get the correct results path in PWSH

Environment data

Name                           Value                                                                                                  
----                           -----                                                                                                  
PSVersion                      5.1.19041.1023                                                                                         
PSEdition                      Desktop                                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                
BuildVersion                   10.0.19041.1023                                                                                        
CLRVersion                     4.0.30319.42000                                                                                        
WSManStackVersion              3.0                                                                                                    
PSRemotingProtocolVersion      2.3                                                                                                    
SerializationVersion           1.1.0.1                                                                                                


&



Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

Powershell 5.1

image

Powershell 7.1.3

image

Metadata

Metadata

Assignees

Labels

Area-FileSystem-Providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions