SQL Server security best practice

Security! This is the word comes in mind of every concerned person when it come...

Change the Collation Settings in MS SQL Server

This post will show you how to change the collation settings in MS SQL Server for specific database...

Resolve collation conflict

In this post I will show you how you can resolve collation conflict error...

Book: SQL Server 2008 High Availability

In this book I have tried to cover every single piece of information that might requires for installing and configuring SQL Server HA option like Clustering, Replication, Log Shipping and Database Mirroring...

Why to recompile Stored Procedure

Generally, we create views and stored procedures (proc here after) ...

Showing posts with label registry. Show all posts
Showing posts with label registry. Show all posts

11/23/2006

Change Authentication Mode with Registry

Hi,
What if we need to change / read / write some registry entry in Server but we donot have access to server!!!! but at the same time we do have SA/Admin privilege on SQL Server (Assuming we need to change registry settings on SQL Server itself ) for example while setting up SQL Server they have installed SQL Server with *Mixed Authentication Mode* and now we need to change it to *Windows Only Authentication Mode* to do so from Query Analyzer we do have xTended Store Procedure to help us they are xp_regread and xp_regwrite
For an instance assume that your Authentication Mode is set to *Mixed Authentication Mode* to read it run below query in QA if it shows ‘0’ or '2' means that authentication mode is Mixed

EXECUTE master..xp_regread
'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',
'LoginMode'

Now if we wants to change it to *Windows Only* run below query in QA

declare @md int

set @md=1

EXECUTE master..xp_regwrite

'HKEY_LOCAL_MACHINE',

'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',

'LoginMode', 'reg_dword', @md

This will make changes in your Registry and change your *Authentication Mode* also.

Disclaimer : In the example above both the xTended Stored Procedure used are Undocumented so use it at your own risk and please check for its availability / support before using it.


This posting is provided * AS IS * for the shake of knowledge sharing only.