Skip to content

Parameter binding error in Copy-Item -ToSession when using range wildcards in -Path #6527

@dronkoff

Description

@dronkoff

Steps to reproduce

$sss = New-PSSession server
Copy-Item -Path 'c:\temp\[x]*' -Destination 'c:\temp' -ToSession $sss

Expected behavior

Everything that starts with the letter 'x' in the temp folder was copied to server "server".

Actual behavior

PS C:\> Copy-Item -Path 'c:\temp\[x]*' -Destination 'c:\temp' -ToSession $sss
Copy-Item : A parameter cannot be found that matches parameter name 'ToSession'.
At line:1 char:55
+ Copy-Item -Path 'c:\temp\[x]*' -Destination 'c:\temp' -ToSession $sss
+                                                       ~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Copy-Item], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Environment data

PS C:\> $PSVersionTable

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

Metadata

Metadata

Assignees

Labels

Issue-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