$conn = new-object System.Data.SqlClient.SQLConnection
$ConnectionString = "Server={0};Database={1};Application Name={2};Integrated Security=True;Connect Timeout={3};ApplicationIntent=ReadOnly" -f $ServerInstance,$Database,$ApplicationName,$ConnectionTimeout
$conn.ConnectionString=$ConnectionString
$conn.Open()