xp_regwrite 'Access is denied.'

  • Hi,

    I have to write to the registry on my SQL 2014 machine. I took the code from my older SQL 2012 machine; however on the SQL 2014 it doesn't work because I get 'Access is denied.'

    EXEC master..xp_regwrite

    @rootkey = 'HKEY_LOCAL_MACHINE',

    @key = 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources',

    @value_name = @pbxNaam,

    @type = 'REG_SZ',

    @value = 'MySQL ODBC 5.1 Driver'

    Msg 22002, Level 16, State 1, Line 7

    RegCreateKeyEx() returned error 5, 'Access is denied.'

    What configuration is needed to solve the problem?


  • Hi,

    I think the SQL Server Service Account does not have full system administrator privileges to the Windows server and is unable to access the Windows registry.

    Is it a domain user or a local service account?

    Has you change the user in the last time?

  • Solved!

    I went into the registry with regedit and looked up the key that I needed to edit. I gave "all users" full permission and then it worked!

    Thanks for your input,

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply