Hello @Jairo Javier Baleta Cali !
I understand you are having issues trying to connect to an SQL Server on premises
I can provide some steps for you to test
First , verify the Instance name . If the instance is the default, the server instance should just be the server's hostname or IP address. The MSSQLSERVER
is implied and not necessary. If it is a named instance, it should be hostname\instancename
. So if you're trying to connect to the default instance on a server named "Remote", you should set -ServerInstance "Remote"
. Also, check that the SQL Server Browser service is running if you are using a named instance.
You can try connecting to the SQL Server using SQL Server Management Studio (SSMS) from the machine where you're running the script. This can help determine whether the problem is with your PowerShell script or with the SQL Server itself.By default, SQL Server uses Windows authentication. If you're trying to authenticate with a username and password, make sure that SQL Server is set to use mixed mode authentication and that the user you're trying to connect with exists and has the necessary permissions.
Also verify that you have Dns resolution and TCP IP connectivity if Management Studio is too much to install.
Test-NetConnection -ComputerName SQLServerHost -Port 1433
Let us know how it goes !
I hope this helps!
Kindly mark the answer as Accepted and Upvote in case it helped!
Regards