SQL Server's several unpublished extended stored procedures for accessing the Registry

Source: Internet
Author: User
SQL Server contains several extended stored procedures that can access the system registry. However, these extended stored procedures are not made public,

These stored procedures are available in SQL Server 7.0 and are retained in SQL Server 2000 and may be deleted later.

The ability to access the system registry in the current SQL Server version, and many people use SQL Server to attack the system,

These extended stored procedures are often used, so it is best to disable them in SQL Server.
Xp_regenumvalues returns all key values in the form of multiple Record Sets
Usage:
Xp_regenumvalues registry Root Key, subkey
For example, you want to see all the key values of HKEY_LOCAL_MACHINE/software/Microsoft/Windows/CurrentVersion/run:
Use master
Exec xp_regenumvalues 'HKEY _ LOCAL_MACHINE ', 'Software/Microsoft/Windows/CurrentVersion/run'

Xp_regread returns the specified key value
Usage:
Xp_regread Root Key, subkey, key value name
Use master
Exec xp_regread 'HKEY _ LOCAL_MACHINE ', 'Software/Microsoft/Windows/currentversion', 'commonfilesdir'

Xp_regwrite write to the Registry
Usage:
Xp_regwrite Root Key, subkey, Value Name, value type, Value
Use master
Exec xp_regwrite 'HKEY _ LOCAL_MACHINE ', 'Software/Microsoft/Windows/currentversion', 'testvaluename', 'reg _ SZ ', 'Hello'
Note that there are two value types: REG_SZ and REG_DWORD.

Xp_regdeletevalue delete a value
Usage:
Xp_regdeletevalue Root Key, subkey, Value Name
Use master
Exec xp_regdeletevalue 'HKEY _ LOCAL_MACHINE ', 'Software/Microsoft/Windows/currentversion', 'testvaluename'

Xp_regdeletekey: delete key, including all values under this key

Usage:
Use master
Xp_regdeletekey 'HKEY _ LOCAL_MACHINE ', 'Software/Microsoft/Windows/CurrentVersion/testkey'

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.