Ok so i have this very simple script. Now When i execute this script it should be all "Hello" becuase of the dot sourcing right? But when i execute it it goes Hello Hello Good Bye Good Bye as if it is making the scope of the script the scope of the function not the other way around. Thank you for your time and help,
$var1 = "Hello"
Function TheFunction{
Write-Host $var1
$var1 = "GoodBye"
Write-Host $var1
}
Write-Host $var1
. TheFunction
Write-Host $var1
|