Clarify Invoke-Command -Scriptblock with & or .
Issue Details
From @BryanWilhite on Twitter: https://twitter.com/bryanwilhite/status/1005191201287430144
Question:
i am not certain that
invoke-command -scriptblock {iisreset}
is the same as
& {iisreset}
ref: https://stackoverflow.com/questions/1670872/how-to-perform-iisreset-with-powershell-script …
the official documentation https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/invoke-command?view=powershell-6 fails to recognize this equivalency
From Bruce Payette
'&' executes in a child scope as does Invoke-Command. '.' executes in the current scope.
From Jeffrey Snover
JPS> $x=1
JPS> &{$x=2};$x 1
JPS> .{$x=2};$x 2
Version(s) of document impacted
- [X] Impacts 6.1 document
- [X] Impacts 6.0 document
- [ ] Impacts 5.1 document
- [ ] Impacts 5.0 document
- [ ] Impacts 4.0 document
- [ ] Impacts 3.0 document
Reason(s) for not selecting all version of documents
- [ ] The documented feature was introduced in selected version of PowerShell
- [ ] This issue only shows up in selected version of the document
- [X] Filed issue on behalf of someone and haven't verified all versions impacted
@bobbytreed - Can you look at this, validate impacted document versions, and update?
See also #2427