I have a problem where I cannot connect to a SQL Server using domain credentials. Using the SA credentials it works and the query runs as expected. But when I use domain cre
If you are not worried about security you can do it like this (not secure, though):
#Set variables here
$connectionString="server=$s;database=$sqlDbName;user id=$userName;password=$passWord";
$sqlConnection=New-Object System.Data.SqlClient.SqlConnection($connectionString);
It works in SQL Server 2012. But, again, not secure. Hope that helps someone...