Chế độ xp_cmd shell trong SQL Server

Hướng dẫn bật tắt xp_cmdshell

DÙNG LỆNH T-SQL

Kiểm tra trạng thái

SELECT CONVERT(INT, ISNULL(value, value_in_use)) AS ConfigValue
FROM sys.configurations
WHERE name = 'xp_cmdshell' ;

Bật sử dụng:

-- Enable advanced options to be changed.
EXEC SP_CONFIGURE 'show advanced options', 1
GO
RECONFIGURE
GO
-- Enable xp_cmdshell option.
EXEC SP_CONFIGURE N'xp_cmdshell', 1
GO
RECONFIGURE
GO

Tắt sử dụng:

-- Disable xp_cmdshell option. 
EXEC SP_CONFIGURE 'xp_cmdshell', 0
GO
RECONFIGURE
GO
-- Disable advanced options to be changed.
EXEC SP_CONFIGURE 'show advanced options', 0
GO
RECONFIGURE
GO

DÙNG MANAGER STUDIO

Last updated