Sql-server – Test SQL Server connection with sqlcmd using machine name

connectivitysql serversql server 2014sqlcmd

How can I test a connection via machine name as the SQL logon name (ie mydomain\server01$ – as an IIS AppPool would connect) using sqlcmd?

I'm having trouble figuring out an application's SQL Server connection issue.

Best Answer

You would generally not find an Application pool using the computer account to connect to SQL Server. At most I would not want to allow that type of configuration.

You should be able to accomplish it by running the process as the local system account, NT AUTHORITY\SYSTEM. You can do this by using psexec. You would just specify -s parameter to execute it as the system account.

I think something like this should work:

psexec -s "sqlcmd -S myserver -E"