-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Type of issue
Missing information
Feedback
The scope docs mention session state but don't explain what it is (or even reference docs to that effect):
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7.4
A quick search turned up the following docs (which are titled as to be specific for Windows PowerShell):
https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/windows-powershell-session-state?view=powershell-7.4
However, they refer to the session state as a configuration/data/information holder, which doesn't explain how session state can be "linked" to the global scope (to use the language of the above scope docs). Also, they refer to PowerShell runspaces which aren't documented at all as far as I can tell (I could only find this archived blog post: https://devblogs.microsoft.com/scripting/beginning-use-of-powershell-runspaces-part-1/).
Finally, the Import-Module docs (specifically for the Scope parameter) are possibly the most confusing of all:
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/import-module?view=powershell-7.4
These docs repeatedly mix scopes and session states as if they were interchangeable (which would contradict the other docs). For example:
By default, when Import-Module cmdlet is called from the command prompt, script file, or scriptblock, all the commands are imported into the global session state. You can use the -Scope Local parameter to import module content into the script or scriptblock scope.
Page URL
Content source URL
Author
Document Id
42772fd1-35e3-2672-05b1-3e5cd9c31ecf