Do you think it is possible to create a SQL Server ODBC Connection for an Active Directory user who doesn't log in to Windows.

Ideally this type of users will be used in a batch process. So, another person logs in and creates a batch process and runs it with another user.

Note: I don't want to enable SQL Server authentication. Instead would like to use Active Directory.


Although you cannot login to SQL Server unless you use either a SQL Server Login or a Windows Account with permissions to connect to the SQL Server, you could create a low-permission user that can EXEC certain stored procedures. Those stored procedures could then contain code that switches into the context of another, more highly privileged account.

SELECT * FROM sys.databases;

Read more about EXECUTE AS on MSDN.


You can deny local logon to a Windows user thus it will only be allowed to be used as a service account.

  • But can you use that service account in an ODBC connection? I cannot find a way to use it the way the OP suggests. I use service accounts in my environment, but client connections through ODBC use the logged in user, unless you configure server auth. – schroeder Apr 2 '13 at 18:13
  • @Schroeder - true, you may be correct if the application is running as the actual user. I've always done it by having the application running as the service account and then connecting via ODBC. It would be trickier if it is a local application, though you could still configure the application to launch as the service user when a local user runs it. – AJ Henderson Apr 2 '13 at 18:15

A quick review of Microsoft documentation suggests the answer is no as it was in 2011 when a very similar question was addressed on Stack Exchange https://stackoverflow.com/questions/6720193/how-can-i-send-an-odbc-connection-string-to-an-sql-server-if-the-user-is-authent

  • Can I create a windows session without that user being logged in? – John Apr 2 '13 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy