SSPI error and DotNetMethod exception while connecting to the SQL DB using powershell script I wrote the following script with the original connection names and credentials.

$SQLServer = "servername" 
$SQLDBName = "dbname"
$SqlQuery = "select * from tbl_Employee "

$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName;
User ID= xyz; Password= abc; trusted_connection=true;"

$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection

$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd

$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)


After hitting enter I get the following error:

Exception calling "Fill" with "1" argument(s) :"Cannot generate SSPI context."
At line:1 char:17
+$SqlAdapter.Fill &lt;&lt;&lt;&lt; ($DataSet)
+CategoryInfo: NotSpecified: (:)[],MethodInvocationException
+FullyQualifiedErrorId: DotNetMethodException


I am trying to connect to the client's database using the given credentials but with the above code, its taking the windows credentials by default.
Connection String should instead read: 

DRIVER=SQL Server;Server=$SQLServer;Database=$SQLDBName;UID=xyz;PWD=abc;