Powershell Variable Scope In Function In Sql