共用方式為


xp_cmdshell 伺服器組態選項

xp_cmdshell選項是SQL Server伺服器組態選項,可讓系統管理員控制是否可以在系統上執行xp_cmdshell擴充預存程式。 根據預設, xp_cmdshell 選項會在新安裝上停用,而且可以使用原則式管理或執行 sp_configure 系統預存程序來啟用,如下列程式碼範例所示:

-- To allow advanced options to be changed.  
EXEC sp_configure 'show advanced options', 1;  
GO  
-- To update the currently configured value for advanced options.  
RECONFIGURE;  
GO  
-- To enable the feature.  
EXEC sp_configure 'xp_cmdshell', 1;  
GO  
-- To update the currently configured value for this feature.  
RECONFIGURE;  
GO  

另請參閱

伺服器組態選項 (SQL Server)
使用原則式管理來管理伺服器