Here are the steps to replace the value of a global variable in PowerShell:-
1) Create a function like this
> function hello ($hi) {$hi = $hi}
2) Before the function calls
> $hi = "Hello World" > $hi Hello World
3) Next call the above function with a dot in front of it and then replace the value of the global variable with the one specified.
> . hello "Hello There!"
The PowerShell’s global variable has been updated!
> $hi Hello There!