This code works perfectly fine when run by launching PowerShell from the start menu or from the PowerShell ISE but when I run it from inside Visual Studio during a custom bu