Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

SQL authentication method

$
0
0

Hello everyone.

I hope someone can provide me some advice. I have a script which works fine, it goes thru a list of SQL servers stored in a text file and returns all those with sysadmin permissions.

Currently the connection is made via windows authentication like this.

 $sqlConn = New-Object System.Data.SqlClient.SqlConnection $sqlConn.ConnectionString = "Data Source=$SQLServer;Integrated Security=TRUE; Initial Catalog=master" $sqlConn.Open;

What I am looking to try to do is connect via SQL authentication , listing the user name and password. I have tried a few different approaches with no success.

Could anyone advise me on how to change the connection string to connect via SQL auth and not via Windows ?

Many thanks for any advice.

 


Viewing all articles
Browse latest Browse all 10624

Trending Articles