-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
HacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Description
When using WinRM-based remoting, the -ScriptBlock argument can be passed positionally; e.g.:
Invoke-Command -ComputerName . { 'hi' }
# Implied: Invoke-Command -ComputerName . -ScriptBlock { 'hi' } Currently, this doesn't work for the equivalent SSH-based remoting commands:
Steps to reproduce
This assumes that the local machine is set up for SSH-based remoting.
{ Invoke-Command -HostName . { 'hi' } } | Should -Not -Throw
{ Invoke-Command -SSHConnection @{ HostName = '.' } { 'hi' } } | Should -Not -ThrowExpected behavior
Both tests should pass.
Actual behavior
Both tests fail as follows:
Expected no exception to be thrown, but an exception
"A positional parameter cannot be found that accepts argument ' 'hi' '." was thrown from line:1 char:3
That is, positional use of the -ScriptBlock parameter is not supported.
Environment data
PowerShell Core 7.0.0-preview.4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
HacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module