Skip to content

Copy-Item to Remote session from a write protected medium throws exception #3615

@volviq

Description

@volviq

Steps to reproduce

# Mount a CD ISO or insert a CD to drive.
# Go to the drives folder:
cd G:
# Establish a remote session (In my case a running Nano Server vm):
$ip=[ip address]
Set-Item WSMan:\localhost\Client\TrustedHosts $ip
$s = New-PSSession -ComputerName $ip -Credential ~\Administrator
#Copy over the file to the remote system:
Copy-Item -ToSession $s -Path .\Filename.example c:\

Expected behavior

No Error messages/Exceptions are shown in case there is no valid reason.

Actual behavior

In case the file is within a mounted ISO, I get the following error message:

Copy-Item : The parameter is incorrect
At line:1 char:1
+ Copy-Item -ToSession $s -Path .\Filename.example c:\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], Win32Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.CopyItemCommand

The file is still successfully copied to the remote system.

Doing the same from a normal hard drive does not show the exception.

Environment data

Reproducible on Official installed Release:

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

And latest Github Release:

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
CLRVersion
PSRemotingProtocolVersion      2.3
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FileSystem-Providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.WG-RemotingPSRP issues with any transport layer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions