Interact with PowerShell’s Global Environment
Problem
You want to store information in the PowerShell environment so that other scripts have access to it.
Solution
To make a variable available to the entire PowerShell session, use a $GLOBAL: prefix when you store information in that variable:
## Create the web service cache, if it doesn't already exist
if(not (TestPath Variable:\Lee.Holmes.WebServiceCache))
{
${GLOBAL:Lee.Holmes.WebServiceCache} = @{}
}
- Read more about Interact with PowerShell’s Global Environment
- Log in or register to post comments