# Can't change authentication mode from Windows to both SQL Server and Windows

As the title suggests I’m having problems changing the authentication mode from Windows to both SQL Server and Windows mode in version 12.0.2. I have tried right right-clicking the server, go to security and change it there but I’m getting an error when doing this. I installed it originally using both but changed it to windows only mode earlier this evening.

The error message I’m getting is long winded but the end of it is:

The EXECUTE permission was denied on the object ‘xp_instance_regwrite’, database ‘mssqlsystemresource’, schema ‘sys’. (Microsoft SQL Server, Error; 229)

Any idea what that means? I’m guessing I don’t have the required permission but I’m not familiar enough with it to know what to do next. I have the sa password but can’t enter it while I’m stuck in Windows mode.

I’ve been trying to figure out why I can’t seem to write to the database all day and in desperation tried changing the mode to see if that would fix it… but it’s only made things worse.

While connected using Windows credentials I tried ALTER LOGIN sa ENABLE also and was given the following error message in response:

Cannot alter the login ‘sa’, because it does not exist or you do not have permission.

I did try altering the registry too to change the mode but realised I was reading a post relating to SQL Server 2005

Here is the solution:

Using SQL Server Management Studio

To change security authentication mode

• In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.

• On the Security page, under Server authentication, select the new server authentication mode, and then click OK.

• In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.

• In Object Explorer, right-click your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.

• In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.

• On the General page, you might have to create and confirm a password for the login.

• On the Status page, in the Login section, click Enabled, and then click OK.

Using Transact-SQL

• In Object Explorer, connect to an instance of Database Engine.

• On the Standard bar, click New Query.

• Copy and paste the following example into the query window and click Execute. The following example enables the sa login and sets a new password.

GO
GO

The EXECUTE permission was denied on the object 'xp_instance_regwrite', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error; 229)

You can fix the problem by granting the user direct access to the procedure.

USE master
GO

GRANT EXECUTE ON [sys].[xp_instance_regread] TO [DOMAINUSER];

--To veriy that the user has been granted the privilege
EXECUTE AS USER = 'DOMAINUSER';Select * from fn_my_permissions('xp_instance_regread','Object')


Cannot alter the login 'sa', because it does not exist or you do not have permission.

Error message saying that, You do not have administrator's permissions

How to change sa user password see here: How to change a password for the sa user in MS SQL? and this link

Answered by CR241 on November 21, 2021

## Related Questions

### TempDB Version Store used by DB STARTUP background process

1  Asked on August 13, 2020 by gio

### How do I send an array of strings to PG from PHP without the former becoming confused?

1  Asked on August 12, 2020 by g-iannello

### How can I check if BULK INSERT is running on a table?

1  Asked on August 3, 2020 by shr

### Issues with MySQL 8.0.17

1  Asked on July 31, 2020 by vishal