Don’t modify out-of-scope items
Scripts, functions, and other elements should NEVER modify the variables, aliases, PSDrives, or other items from parent scopes. Instead, return data to the parent scope using the pipeline. Changing parent scope items creates code which is much more difficult to debug and maintain, and can create inconsistent results when run on different systems.
Tags: global scope, out-of-scope, scope, script scope










