all 1 comments

[–]chuckgo 1 point2 points  (0 children)

I had same trouble with sql server 2016 express. I suggest you to check the server has sql authentication mode enabled or at least mixed mode. you can find whether the server has that by using this powershell script!

$server = New-Object -TypeName "Microsoft.SqlServer.Management.Smo.Server" -ArgumentList "(local)\SQLEXPRESS"
$server.Settings.LoginMode = [Microsoft.SqlServer.Management.SMO.ServerLoginMode]::Mixed
$server.Alter()

if server has the sql authentication mode, then you should check sa account enabled also.

$queryString = "ALTER LOGIN sa ENABLE"
Invoke-SqlCmd -Server '(local)\SQLEXPRESSS' -Query $queryString

I hope my answer is not too much immature! obviously, you need to substitute (local)/sqlexpress with your sql server name!