Title: Invoke-Command -Hostname / -SSHConnection should accept the script block as the (first) positional argument · Issue #10708 · PowerShell/PowerShell · GitHub
Open Graph Title: Invoke-Command -Hostname / -SSHConnection should accept the script block as the (first) positional argument · Issue #10708 · PowerShell/PowerShell
X Title: Invoke-Command -Hostname / -SSHConnection should accept the script block as the (first) positional argument · Issue #10708 · PowerShell/PowerShell
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 equ...
Open Graph 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' } ...
X Description: When using WinRM-based remoting, the -ScriptBlock argument can be passed positionally; e.g.: Invoke-Command -ComputerName . { 'hi' } # Implied: Invoke-Command -ComputerName . -ScriptBlock {...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10708
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invoke-Command -Hostname / -SSHConnection should accept the script block as the (first) positional argument","articleBody":"When using WinRM-based remoting, the `-ScriptBlock` argument can be passed _positionally_; e.g.:\r\n\r\n```powershell\r\nInvoke-Command -ComputerName . { 'hi' } \r\n# Implied: Invoke-Command -ComputerName . -ScriptBlock { 'hi' } \r\n```\r\n\r\nCurrently, this doesn't work for the equivalent SSH-based remoting commands:\r\n\r\n# Steps to reproduce\r\n\r\nThis assumes that the local machine is set up for SSH-based remoting.\r\n\r\n```powershell\r\n{ Invoke-Command -HostName . { 'hi' } } | Should -Not -Throw\r\n{ Invoke-Command -SSHConnection @{ HostName = '.' } { 'hi' } } | Should -Not -Throw\r\n```\r\n\r\n# Expected behavior\r\n\r\nBoth tests should pass.\r\n\r\n# Actual behavior\r\n\r\nBoth tests fail as follows:\r\n\r\n```\r\nExpected no exception to be thrown, but an exception\r\n\"A positional parameter cannot be found that accepts argument ' 'hi' '.\" was thrown from line:1 char:3\r\n```\r\n\r\nThat is, positional use of the `-ScriptBlock` parameter is not supported.\r\n\r\n# Environment data\r\n\r\n```none\r\nPowerShell Core 7.0.0-preview.4\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2019-10-05T02:40:39Z","url":"https://github.com/PowerShell/PowerShell/issues/10708"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dfa4d418-58a7-6ffe-37d7-27423d992a40 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD28:391229:11F126:1874FD:6AFD4C8C |
| html-safe-nonce | 9838c5dc1c2a04ab658cd5c7468082351be5a2b7846ea23645c6c2272572f4d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDI4OjM5MTIyOToxMUYxMjY6MTg3NEZEOjZBRkQ0QzhDIiwidmlzaXRvcl9pZCI6IjkxMjU3NzE1NTI1NDgwMTUyNDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 25b589d0e316d8bf4d1a0f78cd49c16a0d15d03795b89366a84e3ac06ad42ba7 |
| hovercard-subject-tag | issue:502905988 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/10708/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81a1e97ee22bd819ac5c81991df9dbd2c008366dbab1621c6d72e4d612143321/PowerShell/PowerShell/issues/10708 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81a1e97ee22bd819ac5c81991df9dbd2c008366dbab1621c6d72e4d612143321/PowerShell/PowerShell/issues/10708 |
| og:image:alt | When using WinRM-based remoting, the -ScriptBlock argument can be passed positionally; e.g.: Invoke-Command -ComputerName . { 'hi' } # Implied: Invoke-Command -ComputerName . -ScriptBlock { 'hi' } ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width