Global Scope, is it local/global or global/global?

Hello Everyone,

I’ve been reading the About_Scopes help doc:

Looking at the definition of “Global Scopes” I have a question

Global: The scope that is in effect when PowerShell starts.

My question is, does the Global scope exist for each individual powershell.exe instance or does the global scope exist for all powershell.exe instances?

I maybe tying myself up in knots but wondered which way it worked.

Kind Regards, Darren

Every instance has its own global scope

Try it out and see what happens. Within a script, you’d probably use the script scope.

Thank you Bart. I presumed it was on a per powersell.exe instance but wanted to check my assumption.

Hello js,

Thank you for your response.

I do understand the concept of a script scope existing whilst running a script. Also that it is in effect a child scope of the parent/global scope.

What did you mean by “Try it out and see what happens.” Do you have an example I could test please?

Kind Regards, Darren