Scope is a Windows PowerShell feature that defines containers around certain shell elements.
The following items have their own scope.
The shell itself has a scope called the global scope.
Each script that you run is given its own scope.
The inside of each function is given its own scope.
When an item finishes running, its scope is deleted from memory.
Everything that an item creates is created in its own scope.
If a script creates three new variables and two new functions, those five things are created in the
script scope.
When the script finishes running, those five things are removed from memory together with that script.
Scope.
Scope is a complex topic, and complete coverage of scope is not included in this course.
You can learn more about scope by running help about underscore scope, show window and Windows PowerShell.
For now, you have to remember that everything done inside a script can exist only until that script
finishes running.
That means that you have to make some changes to your script if you want to test your function.
In this demonstration, you will see how to test a function that is included inside a script.
One.
Let's open the file.
Function 1.1.
To add a command.
To run the function.
Online 27.
Add the following get net adapt info comp local host.
Three Press control plus s to save the file.
Four Press F five to run the script.