Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-Command help topic has incorrect scope information #4548

mklement0 opened this issue Jul 11, 2019 · 0 comments


None yet
2 participants
Copy link

commented Jul 11, 2019

The linked topic states (emphasis added):

You can also use Invoke-Command on a local computer to evaluate or run a string in a script block as a command. PowerShell converts the script block to a command and runs the command immediately in the current scope,

This is incorrect.
While the command runs in the current scope domain ("internal session state"), it runs in a child scope of the current scope by default; to run directly in the current scope you need to opt in via -NoNewScope.

Document Details

Do not edit this section. It is required for ➟ GitHub issue linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.