$SQLconnection = New-Object System.Data.SqlClient.SqlConnection
$SQLconnection.ConnectionString = \"Server = MySQLservername\\MSSQLSERVER; Database = \"MYSQLDB\"; In
You're constructing your string incorrectly and I'm surprised this works at all for any version. You have "MYSQLDB" in the middle of the connection string and you didn't escape the double quotes in the quoted string. You can see this by running these two commands:
$a = write-output "Server = MySQLservername\MSSQLSERVER; Database = "MYSQLDB"; Integrated Security = True"
$b = write-output "Server = MySQLservername\MSSQLSERVER; Database = `"MYSQLDB`"; Integrated Security = True"
$a.gettype()
$b.gettype()
The first line returns an array instead of a string because the semi-colon is seen as running two commands
Just remember to escape double quotes in double-quoted strings you'll be fine:
$SQLconnection.ConnectionString = "Server = MySQLservername\MSSQLSERVER; Database = `"MYSQLDB`"; Integrated Security = True"